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 UpdatePanel
s 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";
精彩评论