我有一个更新面板和一个gridview,gridview 中的每一行都有2 个按钮。当我单击按钮时,更新进度开始运行,但按钮的事件不会触发。这在我的设计代码中:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" ClientIDMode="Static" CssClass="radtabclass inlineDiv">
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" Orientation="HorizontalTop" SelectedIndex="0" MultiPageID="RadMultiPage1" Skin="Vista">
<Tabs>
<telerik:RadTab Text="Docs" PageViewID="RadPageView1" />
...
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0">
<telerik:RadPageView runat="server" ID="RadPageView1">
<asp:GridView ID="RequestDocGridView" ShowHeaderWhenEmpty="true" ShowHeader="true" CssClass="searchresult_gridview" runat="server" AllowPaging="true" AutoGenerateColumns="False" CellPadding="4" GridLines="None" OnRowCommand="RequestDocGridView_RowCommand"
AlternatingRowStyle-CssClass="AlternatingRowStyle" SelectedRowStyle-CssClass="SelectedRowStyle" EditRowStyle-CssClass="EditRowStyle" FooterStyle-CssClass="FooterStyle" RowStyle-CssClass="RowStyle" PagerStyle-CssClass="PagerStyle" HeaderStyle-CssClass="HeaderStyle" PagerSettings-Mode="NumericFirstLast">
<Columns>
<asp:BoundField DataField="DocumentsByCustomer.DocumentName" HeaderText=" Name" HeaderStyle-CssClass="HeaderStyle" ReadOnly="true" />
<asp:CheckBoxField DataField="IsAvailable" HeaderText="Available" HeaderStyle-CssClass="HeaderStyle" ReadOnly="true" />
<asp:CheckBoxField DataField="DocumentsByCustomer.IsForcible" HeaderText="Force" HeaderStyle-CssClass="HeaderStyle" ReadOnly="true" />
<asp:TemplateField HeaderText="View" HeaderStyle-CssClass="HeaderStyle">
<ItemTemplate>
<asp:ImageButton ID="ViewDocumentImageButton" runat="server" ImageUrl="~/Images/DocumentPicture16x16.png" ToolTip="View" OnClick="ViewDocumentImageButton_Click" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField >
<ItemTemplate>
<asp:Button ID="btnInsert" runat="server" Text="Insert" OnClick="btnInsert_Click" />
<asp:Button ID="btnEdit" runat="server" Text="Edit" OnClick="btnEdit_Click" />
<asp:Button ID="InsertButton" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="Insert" runat="server" Text="Insert" />
<asp:Button ID="EditButton" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="Edit" runat="server" Text="Edit" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</telerik:RadPageView>
<telerik:RadPageView runat="server" ID="RadPageView2">
...
</telerik:RadPageView>
</telerik:RadMultiPage>
</asp:Panel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="1" DynamicLayout="true" AssociatedUpdatePanelID="UpdatePanel1" ClientIDMode="Static">
<ProgressTemplate>
<span class="progressspan">
<img src="../Images/ajax-loader.gif" alt="" />
<label>
Please Wait . . .
</label>
</span>
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
和源代码:
protected void RequestDocGridView_RowCommand(object sender, GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "Insert":
...
break;
case "Delete":
...
break;
case "Edit":
...
break;
default:
break;
}
}
protected void btnInsert_Click(object sender, EventArgs e)
{
....
}
protected void btnEdit_Click(object sender, EventArgs e)
{
....
}