Reputation: 619
I have an updatepanel that includes a textbox, a buttun (named 'search') and a gridview. the gridview has some bound fields (first name and last name) and 1 templated field (a button).
The user inserts a name into the textbox, click the button named 'search' and the gridview is filled with names and buttons.
That works fine and there is no full post back.
The problem is that when the user clicks the button that inside the templated field, there is a partial postback too, and I want to prevet this (The update should occur only when you hit the search button).
So how do I prevent the buttons in the templated field from updating the updatepanel?
Thank you!
Upvotes: 2
Views: 3338
Reputation: 6814
To cause an update only when one of the buttons (ie "search") is clicked, you'll need to put the UpdateMode="Conditional" and set a "trigger" pointing to that button, something like:
<asp:UpdatePanel Id="some" UpdateMode="Conditional"
ChildrenAsTriggers="False" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="SearchButtonId" EventName="Click" />
</Triggers>
<ContentTemplate>
....
</ContentTemplate>
</asp:UpdatePanel>
Upvotes: 5