We can easily fetch controls of master page on child page.
Consider the following example:-
In online shopping site you need to add or remove items which shows on master page based on added items in cart page (Cart page is a child page).
Following is syntax to access the controls:-
Label lblNumberofitems = this.Master.FindControl("lblNumberofitems") as Label;
lblNumberofitems.Text = Convert.ToString(ShoppingCartAccess.ItemCount());
I have find out a label of master page in above code and shows the total count of items in the label.
Happy coding :)
0 Comment(s)