tags:

views:

57

answers:

2

Hi, i have an admin master page where i want to place a label which i can control with two functions (setErrorMessage and setSuccessMessage) both functions assign strings to label's text property and change CssClass property according to function type.

I want to use these functions from nested pages while the control remains centralized on master page so i can return to form in case of error so user could edit wrong input.

How would you suggest me to do that ? either VB or C#

thanks

+1  A: 

you must convert type of Master property in nested page:

((MyMasterPage)this.Master).lblMessage.Text = "Hi.";
Jan Remunda
cool but how do i control this from external class which logs errors ? Should i pass Page object to it or extend Page class ?
eugeneK
Master property is member of Page object of nested page, so if you can access to Page object, you can also get MasterPage object.
Jan Remunda
+4  A: 

You can use below in .aspx

<%@ MasterType VirtualPath="~/MasterPages/Default.master" %>

and below in your code behind,

this.Master.yourMethod 
this.Master.yourProperty

to access your controls in child page.

Krunal