473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Setting Properties to my user control

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
8 2244
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
3
by: countd4 | last post by:
I have built a working user control. However, to make it work, I always have to set certian properties using the properties sheet for the control when using it on other forms. I want to be able to...
9
by: Alphonse Giambrone | last post by:
I have built a simple composite control that consists of a textbox, requiredfieldvalidator and rangevalidator. For properties that are unique to the individual control, I set/get them directly...
3
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the...
2
by: maflatoun | last post by:
Hi everyone, I have the following web user control. I like to set the properties dynamically without using page.databind. <uc1:partnerdownloads id="Partnerdownloads1" PropDomain="<%= Domain...
1
by: David Veeneman | last post by:
I am writing a control that relies on its host to validate the contents of one of its fields. The control fires a custom 'FooNeedsValidating' event and passes the field's data with the event. The...
3
by: Mark Rae | last post by:
Hi, Just a general quickie on setting properties of user controls from the parent form. Let's say I have a user control called note.ascx which displays a datagrid. That datagrid is populated...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
3
by: Mick Walker | last post by:
Hi All, I have a user control on my master page, which exposes 3 public properties (all boolean). Basically by the values of these properties, the user control builds a menu to for users to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.