PC Review


Reply
Thread Tools Rate Thread

Accessing MasterPage Properties from a usercontrol on a contentpage??

 
 
wildman@noclient.net
Guest
Posts: n/a
 
      26th Feb 2008
RE: Accessing MasterPage Properties from a usercontrol on a
contentpage??


On my master page's codebehind I have this property:


Public Property ErrorMsg() As String
Get
Return ErrorLabel.Text
End Get
Set(ByVal value As String)
ErrorLabel.Text = value
End Set
End Property


I've got this on the contentpage,


<%@ MasterType VirtualPath="ShapeUp.master" %>


and I confirmed I can can set the property from the content page.

However on my content page, I have a user control

From inside that user control, I can see all the other properties from
Page.Master , but not ErrorMsg I created on the master page
codebehind.

Also, I've tried this, but it does not work

Dim errorMsg As Label = CType(Page.Master.FindControl("ErrorMsg"),
Label)
errorMsg.Text = "xxxx"

Do I have no choice but to code event handling?


Thanks for any help or information.
 
Reply With Quote
 
 
 
 
Masudur
Guest
Posts: n/a
 
      26th Feb 2008
On Feb 26, 7:16 am, wild...@noclient.net wrote:
> RE: Accessing MasterPage Properties from a usercontrol on a
> contentpage??
>
> On my master page's codebehind I have this property:
>
> Public Property ErrorMsg() As String
> Get
> Return ErrorLabel.Text
> End Get
> Set(ByVal value As String)
> ErrorLabel.Text = value
> End Set
> End Property
>
> I've got this on the contentpage,
>
> <%@ MasterType VirtualPath="ShapeUp.master" %>
>
> and I confirmed I can can set the property from the content page.
>
> However on my content page, I have a user control
>
> From inside that user control, I can see all the other properties from
> Page.Master , but not ErrorMsg I created on the master page
> codebehind.
>
> Also, I've tried this, but it does not work
>
> Dim errorMsg As Label = CType(Page.Master.FindControl("ErrorMsg"),
> Label)
> errorMsg.Text = "xxxx"
>
> Do I have no choice but to code event handling?
>
> Thanks for any help or information.


Hi...

did you tried casting the Page.Master to your class
code in c# will look like this
string msg = (Page.Master as ShapeUp).ErrorMsg;

Masudur
www.munna.shatkotha.com
www.shatkotha.com
 
Reply With Quote
 
wildman@noclient.net
Guest
Posts: n/a
 
      26th Feb 2008
Thanks. I tried this, but it never set the property on the master's
ErrorMsg.

Dim msg As String = TryCast(Page.Master, Master_Shapeup).ErrorMsg
msg = "WTF"

Note: If I simply do

Master.ErrorMsg from the contentpage where the control lives it sets
it.

Am I going to have to do this with event handling? If so, I'm not sure
how.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamically change contentpage in MasterPage ??? Chris Microsoft ASP .NET 2 21st Feb 2010 09:34 AM
Unable to set Masterpage Session to ContentPage Sully Microsoft C# .NET 2 6th Jun 2008 08:09 PM
Calling MasterPage Subroutines from a ContentPage jeffmagill@gmail.com Microsoft ASP .NET 4 21st Jun 2006 04:09 AM
MasterPage Method Invocation from ContentPage User Microsoft ASP .NET 9 19th Dec 2005 11:20 AM
Change Webcontrols from a Contentpage in the Masterpage phil1bruening@web.de Microsoft ASP .NET 1 22nd Nov 2005 03:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:01 PM.