Replace master page menu control - asp.net

I want to replace the menu control of master page from contentplaceholder when i click on submit button
what is the best way to do this?

You just access the control and disable it.
Maybe add a placeholder where you place the new control.
How to access the controls in the master page:
How To retrieve a control in a Master Page from Content Page

Related

Apply conditions from Master Page to multiple asp child pages for Control Level Security in Web Forms

I have ASP.Net web form application including Master Pages, base page (inherited class) and User Header controls. I want to apply server side control security in master or some global page, i will check from database in my master or global page that this page has either add permissions or not, if not i will disable the add button in the child page, same for other buttons.
Can you please suggest me what is the best way to do so?
I am unable to access child class from parent class as per the principle and same for the master page, which cannot access child page, find the image attached for more clarification.
You can use FindControl to locate the Button in the ContentPlaceHolder of the Master Page and then disable it.
Button btn = ContentPlaceHolder1.FindControl("Button1") as Button;
btn.Enabled = false;
Remember that the Page Load of the Master Page is executed AFTER the Page Load of the page using the Master. If you do not know this it can give unexpected results.

How to get data from master page to child page in asp.net

Currently, in a dot net project, i have a master page & a child page. I have given various options, like textbox, combo box etc, on a master page with a submit button. Now i have a child page where i want to process the request sent by master page.
I have heard that retaincontrolstate is used like
private void retainControlState()
{
}
But currently i am not recieving the values from the masterpage onto the child page, not even the click event of the master page.
How can i make the click of master page button to send the request to the child page ?
You should:
Make sure you can access the controls on your master page from the page, e.g. make them public fields
In the Page_Init of your page, cast your the Master property to its proper type (or just use the MasterType directive - https://msdn.microsoft.com/en-us/library/ms228274(v=vs.100).aspx)
Then you can hook up the event handler in your page to the controls on your master page
ControlState has nothing to do with this.
Does it make sense to handle stuff on your master page in your content page's code-behind though? Why not simply do this in the Master page's code-behind?

How to retain control state of master page with diffrent content pages in asp .net

I have some combobox in master page and some content page, when jump from on content page to other state of combobox changed.
How can i preserve the state of combobox in master page.
Thanks in advance.

How to handle Master Page Button Click Events in the Content Page?

I have master page in ASP.NET.
I have added two asp controls to master page i.e. _EmpDROPDOWN and _findBUTTON.
I have one content page. FindEmployee.aspx which shows result list of employees (Gridview) based on the selection made in _EmpDROPDOWN when _FindBUTTON is clicked on Master Page.
I dont know how to read Master Page button click evenet in Content page.
How to read master page button click event (VB.NET syntax) in Content Page ?
Page.Master Property gets the master page that determines the overall look of the page.
MasterPageType masterPage = (MasterPageType) page.Master;

How the .aspx page will contain the user control .ascx page?

i have to create a “aspx” page called “ViewMessageDetail.aspx” which will contain user control “ucViewMessageDetail.ascx”. Since it will be display as lyte box popup. How can i do that??
Try this page
http://www.asp101.com/lessons/usercontrols.asp

Resources