Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Casting a Variable to User control (http://www.velocityreviews.com/forums/t525925-casting-a-variable-to-user-control.html)

Dinu 07-31-2007 11:58 AM

Casting a Variable to User control
 
How to Cast a Variable to User control in ASP.NET using vb.net as code-
behind


Peter Bucher [MVP] 07-31-2007 12:25 PM

Re: Casting a Variable to User control
 
Hello Dinu

> How to Cast a Variable to User control in ASP.NET using vb.net as code-
> behind


Dim myUserControl As UserControl = DirectCast(<var>, UserControl)

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET



Dinu 07-31-2007 12:50 PM

Re: Casting a Variable to User control
 
On Jul 31, 5:25 pm, "Peter Bucher [MVP]" <peter.buc...@aspnetzone.de>
wrote:
> Hello Dinu
>
> > How to Cast a Variable to User control in ASP.NET using vb.net as code-
> > behind

>
> Dim myUserControl As UserControl = DirectCast(<var>, UserControl)
>
> --
> Gruss, Peter Bucher
> Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerlandhttp://www.aspnetzone.de/- ASP.NET Zone, die ASP.NET Communityhttp://www.aspnetzone.de/blogs/peterbucher/- Auf den Spuren von .NET


Hi
thanks for ur response,

can we use Ctype method??


Dinu 07-31-2007 12:54 PM

Re: Casting a Variable to User control
 
Hi Peter,

Can u tell me how can we dynamically access properties of a user
control
in master page from a content page and set properties of user control
in master page from content page


thanks


Peter Bucher [MVP] 07-31-2007 02:35 PM

Re: Casting a Variable to User control
 
Hi Dinu

> can we use Ctype method??

Yes you can, read:
- http://www.google.ch/search?hl=de&q=...rectcast&meta=

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET



Peter Bucher [MVP] 07-31-2007 02:43 PM

Re: Casting a Variable to User control
 
Hi Dinu

> Can u tell me how can we dynamically access properties of a user
> control
> in master page from a content page and set properties of user control
> in master page from content page

Access the masterpage in a contentpage with this.Master.Page, use further
the .FindControl() methode
of the masterpage to find the usercontrol. (Or use .FindControl twice, for
the ContainerControl in the masterpage AND then for the specific usercontrol
within the container.
then cast the usercontrol (Control) to (UserControl) and access the
properties you want.

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET




All times are GMT. The time now is 09:57 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.