ContentPlaceHolder Masterpage Issue
-
Hi, I have a ContentPlaceHolder that is in a masterpage. I have a drop down in my masterpage, and this I am using to try and change certain details in the page(contentplaceholder). My issue is that when the dropdown's selected index event causes the postback (event in master page), it goes into the placeholder code first, before moving out into the masterpage, which seems highly incorrect to me 0_o. any help on this would be greatly appreciated.
-
Hi, I have a ContentPlaceHolder that is in a masterpage. I have a drop down in my masterpage, and this I am using to try and change certain details in the page(contentplaceholder). My issue is that when the dropdown's selected index event causes the postback (event in master page), it goes into the placeholder code first, before moving out into the masterpage, which seems highly incorrect to me 0_o. any help on this would be greatly appreciated.
My sugesstion is to put the code in the content page (since you are trying to change the content page) and add a handler for the dropdownlist's event in the content page.
protected void Page_Init(object sender, EventArgs e) { DropDownList ddl = (DropDownList)this.Master.FindControl("DropDownList1"); ddl.SelectedIndexChanged += new EventHandler(DropDownList1_SelectedIndexChanged); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { //Put code here }
I didn't get any requirements for the signature
-
My sugesstion is to put the code in the content page (since you are trying to change the content page) and add a handler for the dropdownlist's event in the content page.
protected void Page_Init(object sender, EventArgs e) { DropDownList ddl = (DropDownList)this.Master.FindControl("DropDownList1"); ddl.SelectedIndexChanged += new EventHandler(DropDownList1_SelectedIndexChanged); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { //Put code here }
I didn't get any requirements for the signature
thank you very much it works hundreds ^^. I've also used an AJAX Update Panel that effectively Fires the event first, then carries on. I'm wondering which would perform better though =/. curse my curiousity.