473,237 Members | 1,394 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,237 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 2234
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.