By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,398 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

Setting Properties to my user control

P: n/a
Howdy,

I have a user control that is a report to display data. On the page the
control is inserted in, I have filter options to filter the report. When I
try to do something like this, nothing happens.

dim filt as string
... build filter string...

UserControl.ReportFilter = filt

No errors, no report! However if I do this instead, and of course setup the
report to receive the filter from the query string. It works fine

response.redirect("report.asp?REPORT=YES&FILTER=" & filt)

Whats the deal? If I "hard-code" the property into the user control in HTML,
it works there.

<usa:Report runat="server" id="UserControl" ReportFilter="dtDate =
10/25/2005" />

Is this by design or am I missing something??

Thanks!!
--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Nov 19 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
The problem could be in the order of events ..
Do you set UserControl.ReportFilter = filt in the page_load event or else
where?
"David Lozzi" wrote:
Howdy,

I have a user control that is a report to display data. On the page the
control is inserted in, I have filter options to filter the report. When I
try to do something like this, nothing happens.

dim filt as string
... build filter string...

UserControl.ReportFilter = filt

No errors, no report! However if I do this instead, and of course setup the
report to receive the filter from the query string. It works fine

response.redirect("report.asp?REPORT=YES&FILTER=" & filt)

Whats the deal? If I "hard-code" the property into the user control in HTML,
it works there.

<usa:Report runat="server" id="UserControl" ReportFilter="dtDate =
10/25/2005" />

Is this by design or am I missing something??

Thanks!!
--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Nov 19 '05 #2

P: n/a
In the Sub viewreport() that is preocessing the filtering information then
sending it to the control.... hmmm... is that the problem? So the page_load
is already processed and the control is loaded. How do I resolve this?

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
news:23**********************************@microsof t.com...
The problem could be in the order of events ..
Do you set UserControl.ReportFilter = filt in the page_load event or
else
where?
"David Lozzi" wrote:
Howdy,

I have a user control that is a report to display data. On the page the
control is inserted in, I have filter options to filter the report. When
I
try to do something like this, nothing happens.

dim filt as string
... build filter string...

UserControl.ReportFilter = filt

No errors, no report! However if I do this instead, and of course setup
the
report to receive the filter from the query string. It works fine

response.redirect("report.asp?REPORT=YES&FILTER=" & filt)

Whats the deal? If I "hard-code" the property into the user control in
HTML,
it works there.

<usa:Report runat="server" id="UserControl" ReportFilter="dtDate =
10/25/2005" />

Is this by design or am I missing something??

Thanks!!
--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com


Nov 19 '05 #3

P: n/a
Hi David,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 19 '05 #4

P: n/a
Hi David,

Regarding on the Report control you mentioned, is it a 3rd party control or
your own custom web server control? It'll be better if you can provide some
detailed description on that control and how it works. Also, since you
mentioned that it works well when you turn to retrieve the property from
querystring and assign to the report control's Filter property, would you
also provide the complete code of where did you set the Filter originally
(which not work). The ViewReport function dosn't quite makesense, the
important one is where do you call the ViewReport()

If you have anything else unclear, please feel free to post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "David Lozzi" <Da********@nospam.nospam>
| References: <#G**************@TK2MSFTNGP09.phx.gbl>
<23**********************************@microsoft.co m>
| Subject: Re: Setting Properties to my user control
| Date: Fri, 28 Oct 2005 19:17:45 -0400
| Lines: 60
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#l*************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:134666
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| In the Sub viewreport() that is preocessing the filtering information
then
| sending it to the control.... hmmm... is that the problem? So the
page_load
| is already processed and the control is loaded. How do I resolve this?
|
| --
| David Lozzi
| Web Applications Developer
| dlozzi@(remove-this)delphi-ts.com
|
|
|
| "Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
| news:23**********************************@microsof t.com...
| > The problem could be in the order of events ..
| > Do you set UserControl.ReportFilter = filt in the page_load event or
| > else
| > where?
| >
| >
| > "David Lozzi" wrote:
| >
| >> Howdy,
| >>
| >> I have a user control that is a report to display data. On the page the
| >> control is inserted in, I have filter options to filter the report.
When
| >> I
| >> try to do something like this, nothing happens.
| >>
| >> dim filt as string
| >> ... build filter string...
| >>
| >> UserControl.ReportFilter = filt
| >>
| >> No errors, no report! However if I do this instead, and of course
setup
| >> the
| >> report to receive the filter from the query string. It works fine
| >>
| >> response.redirect("report.asp?REPORT=YES&FILTER=" & filt)
| >>
| >> Whats the deal? If I "hard-code" the property into the user control in
| >> HTML,
| >> it works there.
| >>
| >> <usa:Report runat="server" id="UserControl" ReportFilter="dtDate =
| >> 10/25/2005" />
| >>
| >> Is this by design or am I missing something??
| >>
| >> Thanks!!
| >> --
| >> David Lozzi
| >> Web Applications Developer
| >> dlozzi@(remove-this)delphi-ts.com
| >>
| >>
| >>
| >>
| >>
|
|
|

Nov 19 '05 #5

P: n/a
OK, here's hopiong this all makes sense:

report.aspx - parent page
this function, viewreport, builds the query string and then sends it to the
usercontrol called uscReport.
***
Sub viewreport(ByVal sender As Object, ByVal e As System.EventArgs)
Dim filt as string

.... filt is loaded from selected fields ...

uscReport.Filter = filt
uscReport.Visible = True

End Sub
***
rpt_stats.ascx - my customer user control.
Here is the property for the filter, as well as the function that loads the
datagrid.
***
Public Shared Property Filter() As String
Get
Return _filter
End Get
Set(ByVal Value As String)
_filter = Value
End Set
End Property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
LoadMain()
End Sub

Sub LoadMain()
Dim sqlcomm As New SqlCommand("cp_GetSelectedStats", SqlConn)
sqlcomm.CommandType = CommandType.StoredProcedure

sqlcomm.Parameters.Add(New SqlParameter("@Filt", _filt))

dgList.DataSource =
sqlcomm.ExecuteReader(CommandBehavior.CloseConnect ion)
dgList.DataBind()
SqlConn.Close()
End Sub
***

After more troubleshooting, I can get the data to pass when I click the
ViewReport button (which calls viewreport()) twice. So the first time, it
returns nothing, then the 2nd time, it returns the report. If I change
filter criteria, it takes two clicks to get the correct data to appear. It
seems like there is an order issue in how the page is loaded???

Thanks!!!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:Sa****************@TK2MSFTNGXA01.phx.gbl...
Hi David,

Regarding on the Report control you mentioned, is it a 3rd party control
or
your own custom web server control? It'll be better if you can provide
some
detailed description on that control and how it works. Also, since you
mentioned that it works well when you turn to retrieve the property from
querystring and assign to the report control's Filter property, would you
also provide the complete code of where did you set the Filter originally
(which not work). The ViewReport function dosn't quite makesense, the
important one is where do you call the ViewReport()

If you have anything else unclear, please feel free to post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "David Lozzi" <Da********@nospam.nospam>
| References: <#G**************@TK2MSFTNGP09.phx.gbl>
<23**********************************@microsoft.co m>
| Subject: Re: Setting Properties to my user control
| Date: Fri, 28 Oct 2005 19:17:45 -0400
| Lines: 60
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#l*************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:134666
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| In the Sub viewreport() that is preocessing the filtering information
then
| sending it to the control.... hmmm... is that the problem? So the
page_load
| is already processed and the control is loaded. How do I resolve this?
|
| --
| David Lozzi
| Web Applications Developer
| dlozzi@(remove-this)delphi-ts.com
|
|
|
| "Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in message
| news:23**********************************@microsof t.com...
| > The problem could be in the order of events ..
| > Do you set UserControl.ReportFilter = filt in the page_load event
or
| > else
| > where?
| >
| >
| > "David Lozzi" wrote:
| >
| >> Howdy,
| >>
| >> I have a user control that is a report to display data. On the page
the
| >> control is inserted in, I have filter options to filter the report.
When
| >> I
| >> try to do something like this, nothing happens.
| >>
| >> dim filt as string
| >> ... build filter string...
| >>
| >> UserControl.ReportFilter = filt
| >>
| >> No errors, no report! However if I do this instead, and of course
setup
| >> the
| >> report to receive the filter from the query string. It works fine
| >>
| >> response.redirect("report.asp?REPORT=YES&FILTER=" & filt)
| >>
| >> Whats the deal? If I "hard-code" the property into the user control
in
| >> HTML,
| >> it works there.
| >>
| >> <usa:Report runat="server" id="UserControl" ReportFilter="dtDate
=
| >> 10/25/2005" />
| >>
| >> Is this by design or am I missing something??
| >>
| >> Thanks!!
| >> --
| >> David Lozzi
| >> Web Applications Developer
| >> dlozzi@(remove-this)delphi-ts.com
| >>
| >>
| >>
| >>
| >>
|
|
|

Nov 19 '05 #6

P: n/a
Thanks for your response David,

From your further description,
==================
I can get the data to pass when I click the
ViewReport button (which calls viewreport()) twice. So the first time, it
returns nothing, then the 2nd time, it returns the report. If I change
filter criteria, it takes two clicks to get the correct data to appear
===================

yes, surely the problem is caused by event orders. I assume that you create
the UserControl by draging and droping on the page statically (rather than
dynamicalaly). Then, the usercontrol and page's event sequence should be
something like:

#Page load

#User Control load....
(you call the LoadMain() to populate data for UserControl here....)

#Page process postback event(you set the reportFilter as querystring value
here.....)

#here will exist the PreRender event for page and controls

#page render out ....

So I think the time (event ) you set the Filter is always after the
"LoadMain" being called so that the data is always being bind before the
new Filter has been assigned.

IMO, we can consider the following means:

Since we need to ensure that when we perform databinding on the inner
datalist in the UserControl, the usercontrol's ReportFilter property has
been assigned the proper value, we can move the data populating function
into the Usercontrol's prerender event. Something like:

==========
PreRender event of UC......

LoadMain()

End ....
==========

Also, for such problem, the common throubleshooting means is to add some
debug output statement (use Trace or Response ) in the certain function(
e.g the Filter property's setter accessor, Page_load event where you bind
data....)
That can help you get a clear view on how the events happends.

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "David Lozzi" <Da********@nospam.nospam>
| References: <#G**************@TK2MSFTNGP09.phx.gbl>
<23**********************************@microsoft.co m>
<#l*************@TK2MSFTNGP10.phx.gbl>
<Sa**************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: Setting Properties to my user control
| Date: Mon, 31 Oct 2005 14:32:57 -0500
| Lines: 185
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <e8**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:135063
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| OK, here's hopiong this all makes sense:
|
| report.aspx - parent page
| this function, viewreport, builds the query string and then sends it to
the
| usercontrol called uscReport.
| ***
| Sub viewreport(ByVal sender As Object, ByVal e As System.EventArgs)
| Dim filt as string
|
| ... filt is loaded from selected fields ...
|
| uscReport.Filter = filt
| uscReport.Visible = True
|
| End Sub
| ***
|
|
| rpt_stats.ascx - my customer user control.
| Here is the property for the filter, as well as the function that loads
the
| datagrid.
| ***
| Public Shared Property Filter() As String
| Get
| Return _filter
| End Get
| Set(ByVal Value As String)
| _filter = Value
| End Set
| End Property
|
| Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles MyBase.Load
| LoadMain()
| End Sub
|
| Sub LoadMain()
| Dim sqlcomm As New SqlCommand("cp_GetSelectedStats", SqlConn)
| sqlcomm.CommandType = CommandType.StoredProcedure
|
| sqlcomm.Parameters.Add(New SqlParameter("@Filt", _filt))
|
| dgList.DataSource =
| sqlcomm.ExecuteReader(CommandBehavior.CloseConnect ion)
| dgList.DataBind()
| SqlConn.Close()
| End Sub
| ***
|
| After more troubleshooting, I can get the data to pass when I click the
| ViewReport button (which calls viewreport()) twice. So the first time, it
| returns nothing, then the 2nd time, it returns the report. If I change
| filter criteria, it takes two clicks to get the correct data to appear.
It
| seems like there is an order issue in how the page is loaded???
|
| Thanks!!!
|
| --
| David Lozzi
| Web Applications Developer
| dlozzi@(remove-this)delphi-ts.com
|
|
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:Sa****************@TK2MSFTNGXA01.phx.gbl...
| > Hi David,
| >
| > Regarding on the Report control you mentioned, is it a 3rd party
control
| > or
| > your own custom web server control? It'll be better if you can provide
| > some
| > detailed description on that control and how it works. Also, since you
| > mentioned that it works well when you turn to retrieve the property from
| > querystring and assign to the report control's Filter property, would
you
| > also provide the complete code of where did you set the Filter
originally
| > (which not work). The ViewReport function dosn't quite makesense, the
| > important one is where do you call the ViewReport()
| >
| > If you have anything else unclear, please feel free to post here.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | From: "David Lozzi" <Da********@nospam.nospam>
| > | References: <#G**************@TK2MSFTNGP09.phx.gbl>
| > <23**********************************@microsoft.co m>
| > | Subject: Re: Setting Properties to my user control
| > | Date: Fri, 28 Oct 2005 19:17:45 -0400
| > | Lines: 60
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <#l*************@TK2MSFTNGP10.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:134666
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | In the Sub viewreport() that is preocessing the filtering information
| > then
| > | sending it to the control.... hmmm... is that the problem? So the
| > page_load
| > | is already processed and the control is loaded. How do I resolve this?
| > |
| > | --
| > | David Lozzi
| > | Web Applications Developer
| > | dlozzi@(remove-this)delphi-ts.com
| > |
| > |
| > |
| > | "Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in
message
| > | news:23**********************************@microsof t.com...
| > | > The problem could be in the order of events ..
| > | > Do you set UserControl.ReportFilter = filt in the page_load event
| > or
| > | > else
| > | > where?
| > | >
| > | >
| > | > "David Lozzi" wrote:
| > | >
| > | >> Howdy,
| > | >>
| > | >> I have a user control that is a report to display data. On the
page
| > the
| > | >> control is inserted in, I have filter options to filter the report.
| > When
| > | >> I
| > | >> try to do something like this, nothing happens.
| > | >>
| > | >> dim filt as string
| > | >> ... build filter string...
| > | >>
| > | >> UserControl.ReportFilter = filt
| > | >>
| > | >> No errors, no report! However if I do this instead, and of course
| > setup
| > | >> the
| > | >> report to receive the filter from the query string. It works fine
| > | >>
| > | >> response.redirect("report.asp?REPORT=YES&FILTER=" & filt)
| > | >>
| > | >> Whats the deal? If I "hard-code" the property into the user
control
| > in
| > | >> HTML,
| > | >> it works there.
| > | >>
| > | >> <usa:Report runat="server" id="UserControl"
ReportFilter="dtDate
| > =
| > | >> 10/25/2005" />
| > | >>
| > | >> Is this by design or am I missing something??
| > | >>
| > | >> Thanks!!
| > | >> --
| > | >> David Lozzi
| > | >> Web Applications Developer
| > | >> dlozzi@(remove-this)delphi-ts.com
| > | >>
| > | >>
| > | >>
| > | >>
| > | >>
| > |
| > |
| > |
| >
|
|
|

Nov 19 '05 #7

P: n/a
WOO HOO!! Thank you! I put the load function in PreRender and it worked
great!!

Thanks!

--
David Lozzi
Web Applications Developer
dlozzi@(remove-this)delphi-ts.com

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:e4**************@TK2MSFTNGXA01.phx.gbl...
Thanks for your response David,

From your further description,
==================
I can get the data to pass when I click the
ViewReport button (which calls viewreport()) twice. So the first time, it
returns nothing, then the 2nd time, it returns the report. If I change
filter criteria, it takes two clicks to get the correct data to appear
===================

yes, surely the problem is caused by event orders. I assume that you
create
the UserControl by draging and droping on the page statically (rather than
dynamicalaly). Then, the usercontrol and page's event sequence should be
something like:

#Page load

#User Control load....
(you call the LoadMain() to populate data for UserControl here....)

#Page process postback event(you set the reportFilter as querystring value
here.....)

#here will exist the PreRender event for page and controls

#page render out ....

So I think the time (event ) you set the Filter is always after the
"LoadMain" being called so that the data is always being bind before the
new Filter has been assigned.

IMO, we can consider the following means:

Since we need to ensure that when we perform databinding on the inner
datalist in the UserControl, the usercontrol's ReportFilter property has
been assigned the proper value, we can move the data populating function
into the Usercontrol's prerender event. Something like:

==========
PreRender event of UC......

LoadMain()

End ....
==========

Also, for such problem, the common throubleshooting means is to add some
debug output statement (use Trace or Response ) in the certain function(
e.g the Filter property's setter accessor, Page_load event where you bind
data....)
That can help you get a clear view on how the events happends.

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "David Lozzi" <Da********@nospam.nospam>
| References: <#G**************@TK2MSFTNGP09.phx.gbl>
<23**********************************@microsoft.co m>
<#l*************@TK2MSFTNGP10.phx.gbl>
<Sa**************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: Setting Properties to my user control
| Date: Mon, 31 Oct 2005 14:32:57 -0500
| Lines: 185
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <e8**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:135063
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| OK, here's hopiong this all makes sense:
|
| report.aspx - parent page
| this function, viewreport, builds the query string and then sends it to
the
| usercontrol called uscReport.
| ***
| Sub viewreport(ByVal sender As Object, ByVal e As System.EventArgs)
| Dim filt as string
|
| ... filt is loaded from selected fields ...
|
| uscReport.Filter = filt
| uscReport.Visible = True
|
| End Sub
| ***
|
|
| rpt_stats.ascx - my customer user control.
| Here is the property for the filter, as well as the function that loads
the
| datagrid.
| ***
| Public Shared Property Filter() As String
| Get
| Return _filter
| End Get
| Set(ByVal Value As String)
| _filter = Value
| End Set
| End Property
|
| Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles MyBase.Load
| LoadMain()
| End Sub
|
| Sub LoadMain()
| Dim sqlcomm As New SqlCommand("cp_GetSelectedStats",
SqlConn)
| sqlcomm.CommandType = CommandType.StoredProcedure
|
| sqlcomm.Parameters.Add(New SqlParameter("@Filt", _filt))
|
| dgList.DataSource =
| sqlcomm.ExecuteReader(CommandBehavior.CloseConnect ion)
| dgList.DataBind()
| SqlConn.Close()
| End Sub
| ***
|
| After more troubleshooting, I can get the data to pass when I click the
| ViewReport button (which calls viewreport()) twice. So the first time,
it
| returns nothing, then the 2nd time, it returns the report. If I change
| filter criteria, it takes two clicks to get the correct data to appear.
It
| seems like there is an order issue in how the page is loaded???
|
| Thanks!!!
|
| --
| David Lozzi
| Web Applications Developer
| dlozzi@(remove-this)delphi-ts.com
|
|
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:Sa****************@TK2MSFTNGXA01.phx.gbl...
| > Hi David,
| >
| > Regarding on the Report control you mentioned, is it a 3rd party
control
| > or
| > your own custom web server control? It'll be better if you can provide
| > some
| > detailed description on that control and how it works. Also, since
you
| > mentioned that it works well when you turn to retrieve the property
from
| > querystring and assign to the report control's Filter property, would
you
| > also provide the complete code of where did you set the Filter
originally
| > (which not work). The ViewReport function dosn't quite makesense, the
| > important one is where do you call the ViewReport()
| >
| > If you have anything else unclear, please feel free to post here.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | From: "David Lozzi" <Da********@nospam.nospam>
| > | References: <#G**************@TK2MSFTNGP09.phx.gbl>
| > <23**********************************@microsoft.co m>
| > | Subject: Re: Setting Properties to my user control
| > | Date: Fri, 28 Oct 2005 19:17:45 -0400
| > | Lines: 60
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <#l*************@TK2MSFTNGP10.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:134666
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | In the Sub viewreport() that is preocessing the filtering
information
| > then
| > | sending it to the control.... hmmm... is that the problem? So the
| > page_load
| > | is already processed and the control is loaded. How do I resolve
this?
| > |
| > | --
| > | David Lozzi
| > | Web Applications Developer
| > | dlozzi@(remove-this)delphi-ts.com
| > |
| > |
| > |
| > | "Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in
message
| > | news:23**********************************@microsof t.com...
| > | > The problem could be in the order of events ..
| > | > Do you set UserControl.ReportFilter = filt in the page_load
event
| > or
| > | > else
| > | > where?
| > | >
| > | >
| > | > "David Lozzi" wrote:
| > | >
| > | >> Howdy,
| > | >>
| > | >> I have a user control that is a report to display data. On the
page
| > the
| > | >> control is inserted in, I have filter options to filter the
report.
| > When
| > | >> I
| > | >> try to do something like this, nothing happens.
| > | >>
| > | >> dim filt as string
| > | >> ... build filter string...
| > | >>
| > | >> UserControl.ReportFilter = filt
| > | >>
| > | >> No errors, no report! However if I do this instead, and of course
| > setup
| > | >> the
| > | >> report to receive the filter from the query string. It works fine
| > | >>
| > | >> response.redirect("report.asp?REPORT=YES&FILTER=" & filt)
| > | >>
| > | >> Whats the deal? If I "hard-code" the property into the user
control
| > in
| > | >> HTML,
| > | >> it works there.
| > | >>
| > | >> <usa:Report runat="server" id="UserControl"
ReportFilter="dtDate
| > =
| > | >> 10/25/2005" />
| > | >>
| > | >> Is this by design or am I missing something??
| > | >>
| > | >> Thanks!!
| > | >> --
| > | >> David Lozzi
| > | >> Web Applications Developer
| > | >> dlozzi@(remove-this)delphi-ts.com
| > | >>
| > | >>
| > | >>
| > | >>
| > | >>
| > |
| > |
| > |
| >
|
|
|

Nov 19 '05 #8

P: n/a
You're welcome David,

Good luck!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "David Lozzi" <Da********@nospam.nospam>
| References: <#G**************@TK2MSFTNGP09.phx.gbl>
<23**********************************@microsoft.co m>
<#l*************@TK2MSFTNGP10.phx.gbl>
<Sa**************@TK2MSFTNGXA01.phx.gbl>
<e8**************@TK2MSFTNGP12.phx.gbl>
<e4**************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: Setting Properties to my user control
| Date: Wed, 2 Nov 2005 12:16:58 -0500
| Lines: 311
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <Ow**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:135553
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| WOO HOO!! Thank you! I put the load function in PreRender and it worked
| great!!
|
| Thanks!
|
| --
| David Lozzi
| Web Applications Developer
| dlozzi@(remove-this)delphi-ts.com
|
|
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:e4**************@TK2MSFTNGXA01.phx.gbl...
| > Thanks for your response David,
| >
| > From your further description,
| > ==================
| > I can get the data to pass when I click the
| > ViewReport button (which calls viewreport()) twice. So the first time,
it
| > returns nothing, then the 2nd time, it returns the report. If I change
| > filter criteria, it takes two clicks to get the correct data to appear
| > ===================
| >
| > yes, surely the problem is caused by event orders. I assume that you
| > create
| > the UserControl by draging and droping on the page statically (rather
than
| > dynamicalaly). Then, the usercontrol and page's event sequence should be
| > something like:
| >
| > #Page load
| >
| > #User Control load....
| > (you call the LoadMain() to populate data for UserControl here....)
| >
| > #Page process postback event(you set the reportFilter as querystring
value
| > here.....)
| >
| > #here will exist the PreRender event for page and controls
| >
| > #page render out ....
| >
| > So I think the time (event ) you set the Filter is always after the
| > "LoadMain" being called so that the data is always being bind before
the
| > new Filter has been assigned.
| >
| > IMO, we can consider the following means:
| >
| > Since we need to ensure that when we perform databinding on the inner
| > datalist in the UserControl, the usercontrol's ReportFilter property has
| > been assigned the proper value, we can move the data populating
function
| > into the Usercontrol's prerender event. Something like:
| >
| > ==========
| > PreRender event of UC......
| >
| > LoadMain()
| >
| > End ....
| > ==========
| >
| > Also, for such problem, the common throubleshooting means is to add some
| > debug output statement (use Trace or Response ) in the certain function(
| > e.g the Filter property's setter accessor, Page_load event where you
bind
| > data....)
| > That can help you get a clear view on how the events happends.
| >
| > Hope helps. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| > --------------------
| > | From: "David Lozzi" <Da********@nospam.nospam>
| > | References: <#G**************@TK2MSFTNGP09.phx.gbl>
| > <23**********************************@microsoft.co m>
| > <#l*************@TK2MSFTNGP10.phx.gbl>
| > <Sa**************@TK2MSFTNGXA01.phx.gbl>
| > | Subject: Re: Setting Properties to my user control
| > | Date: Mon, 31 Oct 2005 14:32:57 -0500
| > | Lines: 185
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | X-RFC2646: Format=Flowed; Original
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | Message-ID: <e8**************@TK2MSFTNGP12.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:135063
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | OK, here's hopiong this all makes sense:
| > |
| > | report.aspx - parent page
| > | this function, viewreport, builds the query string and then sends it
to
| > the
| > | usercontrol called uscReport.
| > | ***
| > | Sub viewreport(ByVal sender As Object, ByVal e As System.EventArgs)
| > | Dim filt as string
| > |
| > | ... filt is loaded from selected fields ...
| > |
| > | uscReport.Filter = filt
| > | uscReport.Visible = True
| > |
| > | End Sub
| > | ***
| > |
| > |
| > | rpt_stats.ascx - my customer user control.
| > | Here is the property for the filter, as well as the function that
loads
| > the
| > | datagrid.
| > | ***
| > | Public Shared Property Filter() As String
| > | Get
| > | Return _filter
| > | End Get
| > | Set(ByVal Value As String)
| > | _filter = Value
| > | End Set
| > | End Property
| > |
| > | Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
| > | System.EventArgs) Handles MyBase.Load
| > | LoadMain()
| > | End Sub
| > |
| > | Sub LoadMain()
| > | Dim sqlcomm As New SqlCommand("cp_GetSelectedStats",
| > SqlConn)
| > | sqlcomm.CommandType = CommandType.StoredProcedure
| > |
| > | sqlcomm.Parameters.Add(New SqlParameter("@Filt", _filt))
| > |
| > | dgList.DataSource =
| > | sqlcomm.ExecuteReader(CommandBehavior.CloseConnect ion)
| > | dgList.DataBind()
| > | SqlConn.Close()
| > | End Sub
| > | ***
| > |
| > | After more troubleshooting, I can get the data to pass when I click
the
| > | ViewReport button (which calls viewreport()) twice. So the first
time,
| > it
| > | returns nothing, then the 2nd time, it returns the report. If I change
| > | filter criteria, it takes two clicks to get the correct data to
appear.
| > It
| > | seems like there is an order issue in how the page is loaded???
| > |
| > | Thanks!!!
| > |
| > | --
| > | David Lozzi
| > | Web Applications Developer
| > | dlozzi@(remove-this)delphi-ts.com
| > |
| > |
| > |
| > | "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| > | news:Sa****************@TK2MSFTNGXA01.phx.gbl...
| > | > Hi David,
| > | >
| > | > Regarding on the Report control you mentioned, is it a 3rd party
| > control
| > | > or
| > | > your own custom web server control? It'll be better if you can
provide
| > | > some
| > | > detailed description on that control and how it works. Also, since
| > you
| > | > mentioned that it works well when you turn to retrieve the property
| > from
| > | > querystring and assign to the report control's Filter property,
would
| > you
| > | > also provide the complete code of where did you set the Filter
| > originally
| > | > (which not work). The ViewReport function dosn't quite makesense,
the
| > | > important one is where do you call the ViewReport()
| > | >
| > | > If you have anything else unclear, please feel free to post here.
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | From: "David Lozzi" <Da********@nospam.nospam>
| > | > | References: <#G**************@TK2MSFTNGP09.phx.gbl>
| > | > <23**********************************@microsoft.co m>
| > | > | Subject: Re: Setting Properties to my user control
| > | > | Date: Fri, 28 Oct 2005 19:17:45 -0400
| > | > | Lines: 60
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <#l*************@TK2MSFTNGP10.phx.gbl>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
| > | > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet:134666
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > |
| > | > | In the Sub viewreport() that is preocessing the filtering
| > information
| > | > then
| > | > | sending it to the control.... hmmm... is that the problem? So the
| > | > page_load
| > | > | is already processed and the control is loaded. How do I resolve
| > this?
| > | > |
| > | > | --
| > | > | David Lozzi
| > | > | Web Applications Developer
| > | > | dlozzi@(remove-this)delphi-ts.com
| > | > |
| > | > |
| > | > |
| > | > | "Sreejith Ram" <Sr*********@discussions.microsoft.com> wrote in
| > message
| > | > | news:23**********************************@microsof t.com...
| > | > | > The problem could be in the order of events ..
| > | > | > Do you set UserControl.ReportFilter = filt in the page_load
| > event
| > | > or
| > | > | > else
| > | > | > where?
| > | > | >
| > | > | >
| > | > | > "David Lozzi" wrote:
| > | > | >
| > | > | >> Howdy,
| > | > | >>
| > | > | >> I have a user control that is a report to display data. On the
| > page
| > | > the
| > | > | >> control is inserted in, I have filter options to filter the
| > report.
| > | > When
| > | > | >> I
| > | > | >> try to do something like this, nothing happens.
| > | > | >>
| > | > | >> dim filt as string
| > | > | >> ... build filter string...
| > | > | >>
| > | > | >> UserControl.ReportFilter = filt
| > | > | >>
| > | > | >> No errors, no report! However if I do this instead, and of
course
| > | > setup
| > | > | >> the
| > | > | >> report to receive the filter from the query string. It works
fine
| > | > | >>
| > | > | >> response.redirect("report.asp?REPORT=YES&FILTER=" & filt)
| > | > | >>
| > | > | >> Whats the deal? If I "hard-code" the property into the user
| > control
| > | > in
| > | > | >> HTML,
| > | > | >> it works there.
| > | > | >>
| > | > | >> <usa:Report runat="server" id="UserControl"
| > ReportFilter="dtDate
| > | > =
| > | > | >> 10/25/2005" />
| > | > | >>
| > | > | >> Is this by design or am I missing something??
| > | > | >>
| > | > | >> Thanks!!
| > | > | >> --
| > | > | >> David Lozzi
| > | > | >> Web Applications Developer
| > | > | >> dlozzi@(remove-this)delphi-ts.com
| > | > | >>
| > | > | >>
| > | > | >>
| > | > | >>
| > | > | >>
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.