Button inside updatepanel not working
I am retrieving download urls from a database on Button2
but when I put my GridView
inside the UpdatePanel
, it gives me following error:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorEx开发者_StackOverflowception:
Code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" ShowHeaderWhenEmpty="True"
EmptyDataText="No Uploads are found" ShowEmptyTable="True"
ShowFooterWhenEmpty="False" Style="margin-top: 20px"
OnSelectedIndexChanged="GridView2_SelectedIndexChanged"
OnRowDataBound="GridView2_RowDataBound">
<asp:TemplateField ShowHeader="False" HeaderText="Receive">
<ItemTemplate>
<asp:Button ID="Button2" runat="server" CausesValidation="false" CommandName="select" Text="Receive" />
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
Try adding a trigger within your UpdatePanel:
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
</Triggers>
精彩评论