Ask a Question related to ASP.NET General, Design and Development.
-
marshal #1
@ OutputCache in usercontrol problem
Hi to All,
I am using <% @ OutputCache Duration="60"
VaryByParam="none" %> in my
usercontrol say "myControl.ascx". This user control has a
property say
"title".
Now am Dynamically Loading this control in "myPage.aspx"
like this
Control ctl = LoadControl("myControl.ascx").
and then performing casting operation in order to set the
property value
((myControl)ctl).title = "Welcome to my Site"
But when i run the page it gives me following error
System.InvalidCastException. Specified cast is not valid.
And the beauty of this problem is that when i remove the
line <% @
OutputCache Duration="60" VaryByParam="none" %> The page
successfully
executes.
Please suggest.
Thanx in advance
Marshal
marshal Guest
-
usercontrol problem
Hi, I am just progamming using asp.net, and I want create a usercontrol to display some dynamic(from database) contents. Is this possible? ... -
Problem with datagrid in userControl
Hi I have a UserControl wich contains a datagrid .The Usercontrol is add dynamicly to the page. My problem is that i have to click twice on the ... -
Problem with a usercontrol
Dear Friends, I'm working on a web based(ASP.Net) project. This project contains multiple web projects. I want to use a usercontrol which has been... -
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack
a uscontrol test.ascx have a dropdownlist web control the dropdownlist's AutoPostBack property is set "true" but when i use... -
Programatically remove @OutputCache
I orignally posted this question. Thanks for your response. I can not check this variable when the page is initalised or loaded as for cached... -
Rory #2
@ OutputCache in usercontrol problem
make sure that the header information for your control
file contains a class name
eg <%Control ClassName="myControl"%>
for further info on loading controls dynamically:
[url]http://msdn.microsoft.com/library/default.asp?[/url]
url=/library/en-
us/cpguide/html/cpconinstantiatingusercontrolsprogrammatica
lly.asp
also note: if the user control supports caching, the
object returned from this method is not actually a
UserControl, but a PartialCachingControl.
>-----Original Message-----
>Hi to All,
>
>I am using <% @ OutputCache Duration="60"
>VaryByParam="none" %> in my
>usercontrol say "myControl.ascx". This user control has a
>property say
>"title".
>
>Now am Dynamically Loading this control in "myPage.aspx"
>like this
>Control ctl = LoadControl("myControl.ascx").
>and then performing casting operation in order to set the
>property value
>((myControl)ctl).title = "Welcome to my Site"
>
>But when i run the page it gives me following error
>System.InvalidCastException. Specified cast is not valid.
>
>And the beauty of this problem is that when i remove the
>line <% @
>OutputCache Duration="60" VaryByParam="none" %> The page
>successfully
>executes.
>
>
>Please suggest.
>
>Thanx in advance
>Marshal
>
>
>
>
>
>
>.
>Rory Guest
-
Marshal #3
@ OutputCache in usercontrol problem
Hi rory,
i have checked the className its correct
As u r telling me that return type is
PartialCachingControl not usercontrol so now how do i
access the property of the control.
i guess am doing wrong casting..
Marshall
[url]http://msdn.microsoft.com/library/default.asp?[/url]>-----Original Message-----
>make sure that the header information for your control
>file contains a class name
>eg <%Control ClassName="myControl"%>
>
>for further info on loading controls dynamically:
>a>url=/library/en-
>us/cpguide/html/cpconinstantiatingusercontrolsprogrammatica>lly.asp
>
>also note: if the user control supports caching, the
>object returned from this method is not actually a
>UserControl, but a PartialCachingControl.
>
>
>>>-----Original Message-----
>>Hi to All,
>>
>>I am using <% @ OutputCache Duration="60"
>>VaryByParam="none" %> in my
>>usercontrol say "myControl.ascx". This user control hasthe>>property say
>>"title".
>>
>>Now am Dynamically Loading this control in "myPage.aspx"
>>like this
>>Control ctl = LoadControl("myControl.ascx").
>>and then performing casting operation in order to set>.>>property value
>>((myControl)ctl).title = "Welcome to my Site"
>>
>>But when i run the page it gives me following error
>>System.InvalidCastException. Specified cast is not valid.
>>
>>And the beauty of this problem is that when i remove the
>>line <% @
>>OutputCache Duration="60" VaryByParam="none" %> The page
>>successfully
>>executes.
>>
>>
>>Please suggest.
>>
>>Thanx in advance
>>Marshal
>>
>>
>>
>>
>>
>>
>>.
>>
>Marshal Guest
-
Marshal #4
@ OutputCache in usercontrol problem
Hi rory,
i have checked the className its correct
As u r telling me that return type is
PartialCachingControl not usercontrol so now how do i
access the property of the control.
i guess am doing wrong casting..
Marshall
[url]http://msdn.microsoft.com/library/default.asp?[/url]>-----Original Message-----
>make sure that the header information for your control
>file contains a class name
>eg <%Control ClassName="myControl"%>
>
>for further info on loading controls dynamically:
>a>url=/library/en-
>us/cpguide/html/cpconinstantiatingusercontrolsprogrammatica>lly.asp
>
>also note: if the user control supports caching, the
>object returned from this method is not actually a
>UserControl, but a PartialCachingControl.
>
>
>>>-----Original Message-----
>>Hi to All,
>>
>>I am using <% @ OutputCache Duration="60"
>>VaryByParam="none" %> in my
>>usercontrol say "myControl.ascx". This user control hasthe>>property say
>>"title".
>>
>>Now am Dynamically Loading this control in "myPage.aspx"
>>like this
>>Control ctl = LoadControl("myControl.ascx").
>>and then performing casting operation in order to set>.>>property value
>>((myControl)ctl).title = "Welcome to my Site"
>>
>>But when i run the page it gives me following error
>>System.InvalidCastException. Specified cast is not valid.
>>
>>And the beauty of this problem is that when i remove the
>>line <% @
>>OutputCache Duration="60" VaryByParam="none" %> The page
>>successfully
>>executes.
>>
>>
>>Please suggest.
>>
>>Thanx in advance
>>Marshal
>>
>>
>>
>>
>>
>>
>>.
>>
>Marshal Guest



Reply With Quote

