I have the code below which looks like it should work. However, the trigger that references the control with the controlID of “gvSearch” is actually a gridview inside a user control page.
How can I access that gridview so that I can use it as a trigger?
Thanks!
<asp:UpdatePanel ID="pnlSearch" ChildrenAsTriggers="true" runat="server" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSearch" />
<asp:AsyncPostBackTrigger ControlID="gvSearch" />
</Triggers>
</asp:UpdatePanel>
Thanks!
Outline:
<%@ Page Title="test">
<%@ Register src="test1.ascx" tagname="test1" tagprefix="test1uc" %>
<UpdatePanel>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSearch" />
<asp:AsyncPostBackTrigger ControlID="gvSearch" />
</Triggers>
<ContentTemplate>
<test1uc:test1 ID="test1a" runat="server" />
</ContentTemplate>
</UpdatePanel>
What event do you want to use as trigger, the
SelectedIndexChanged-event? Then apply the appropriateEventName.However, that should already be the default event for
GridView(see theremarkssection).Have a look at this thread: http://forums.asp.net/t/1136932.aspx
Update I think the best approach in your situation is to provide a custom event in your UserControl that is bubbled from the
SelectedIndexChangedevent from theGridViewin the UC. Then you can use this event asAsyncPostBackTriggerfor yourUpdatePanel, e.g.: