开发者

How to trigger UpdatePanel update from MasterPage?

开发者 https://www.devze.com 2023-03-08 18:19 出处:网络
I have an UpdatePanel in a dynamically loaded UserControl, which is in a TabPanel of a TabContainer. Is it poss开发者_如何转开发ible to specify in markup an asp:LinkButton in the MasterPage as an Upda

I have an UpdatePanel in a dynamically loaded UserControl, which is in a TabPanel of a TabContainer. Is it poss开发者_如何转开发ible to specify in markup an asp:LinkButton in the MasterPage as an UpdatePanels trigger?


You can dynamically add a AsyncPostBackTrigger or PostBackTrigger

Here is how can you do this:

AsyncPostBackTrigger apTrigger = new AsyncPostBackTrigger();
apTrigger.ControlID = "LinkButtonId";
apTrigger.EventName = "Click";
((UpdatePanel)((TabPanel)TabContainID.FindControl("tabPanel")).FindControl("UpdatePanelID")).Triggers.Add(apTrigger);

Edit: If the control is in a Master Page then first you need to find the LinkButton.

LinkButton LinkButtonId = (LinkButton)Master.FindControl("LinkButtonId");
apTrigger.ControlID = "LinkButtonId";
0

精彩评论

暂无评论...
验证码 换一张
取 消