|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Access property and control of master page from a customized parent page classI have a ASP.NET 2.0 web page which inherits a customized base page class
and have a master page, their relation is as below Customized base page class --> web page --> master page How to access the property and control of master page from the customized base page class? Btw, I can access the server control of master page from base page class via Cast + FinndControl, however this method doesn't work on access a user control. how to solve? Thanks in advance! You could try exposing the control as a property in the master page.
Show quoteHide quote "RedHair" wrote: > I have a ASP.NET 2.0 web page which inherits a customized base page class > and have a master page, > their relation is as below > > Customized base page class --> web page --> master page > > How to access the property and control of master page from the customized > base page class? > > Btw, I can access the server control of master page from base page class via > Cast + FinndControl, > however this method doesn't work on access a user control. how to solve? > > Thanks in advance! > > > Thanks for reply, however the base class can't access the property of master
page Show quoteHide quote "clickon" <clic***@discussions.microsoft.com> wrote in message news:2A01DD12-C320-446A-A9CF-26E9D9139A0F@microsoft.com... > You could try exposing the control as a property in the master page. > > > > "RedHair" wrote: > >> I have a ASP.NET 2.0 web page which inherits a customized base page class >> and have a master page, >> their relation is as below >> >> Customized base page class --> web page --> master page >> >> How to access the property and control of master page from the customized >> base page class? >> >> Btw, I can access the server control of master page from base page class >> via >> Cast + FinndControl, >> however this method doesn't work on access a user control. how to solve? >> >> Thanks in advance! >> >> >> I don't know if I understood your question correctly but here goes.
'Access base class' master page. Dim myBMP As MasterPage = Me.MyBase.Master 'Find a user control called "myControl" in base class' master Dim myControl As UserControl = myBMP.FindControl("myControl") 'Or perhaps Dim myControl As UserControl = CType(MyBMP.FindControl("myControl"), UserControl) I am trying to access the page's master page from this page's parent class.
<CaffieneR***@gmail.com> ???????:1143065341.922150.98***@i40g2000cwc.googlegroups.com... Show quoteHide quote >I don't know if I understood your question correctly but here goes. > > 'Access base class' master page. > Dim myBMP As MasterPage = Me.MyBase.Master > > 'Find a user control called "myControl" in base class' master > Dim myControl As UserControl = myBMP.FindControl("myControl") > 'Or perhaps > Dim myControl As UserControl = CType(MyBMP.FindControl("myControl"), > UserControl) >
How to add client script to a pushbutton in datagrid
How do change layout od SideBar in Wizard control? (ASP.NET 2.0) FileUpload - keep the filename GridView disapears after entering edit mode. ObjectDataSource method as another ObjectDataSource Navigation Menu Site Map Difficulties WebPart and WebPartZones Usage Alignment of webcontrols... Intellisense question CustomControl and body.onload |
|||||||||||||||||||||||