我使用弹出式编辑表单模板实现了带有添加/更新选项的 Telerik 网格。没有 ajax 一切正常,当我启用 ajax 弹出表单事件时没有正确触发。我已经定义了 CommandName 并且在服务器端我实现了 ItemCommand 事件。如果我在表单的所有事件上应用断点,那么在单击弹出按钮后,只会调用表单的 Load 方法,不会发生其他任何事情。请帮助以下是我的客户端代码
<telerik:RadGrid ID="gridMain" runat="server" EnableEmbeddedSkins="False" Skin="MpoGrayGrid" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" OnItemDataBound="gridMain_ItemDataBound" OnNeedDataSource="gridMain_NeedDataSource" OnItemCommand="gridMain_ItemCommand">
<MasterTableView EditMode="PopUp" CommandItemDisplay="Top" DataKeyNames="EEHireTermID">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column" Created="True"></ExpandCollapseColumn>
<Columns>
<telerik:GridTemplateColumn HeaderText="Employee">
<ItemTemplate>
<asp:Label runat="server" ID="lblName"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Type">
<ItemTemplate>
<asp:Label runat="server" ID="lblType"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="ActionDate">
<ItemTemplate>
<asp:Label runat="server" ID="lblActionDate"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Entered Date">
<ItemTemplate>
<asp:Label runat="server" ID="lblEnteredDate"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Entered By">
<ItemTemplate>
<asp:Label runat="server" ID="lblEnteredBy"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Reason For Termination">
<ItemTemplate>
<asp:Label runat="server" ID="lblTermReason"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Memo">
<ItemTemplate>
<asp:Label runat="server" ID="lblMemo"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Action">
<ItemTemplate>
<asp:LinkButton runat="server" ID="btnEdit" CausesValidation="False" Text="Edit" CssClass="Link2" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' CommandName="Edit"></asp:LinkButton> |
<asp:LinkButton runat="server" ID="btnDelete" CausesValidation="False" Text="Delete" CssClass="Link2" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' CommandName="Delete"></asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<EditFormSettings InsertCaption="Add Hire/Termination Dates" CaptionFormatString="Add Hire/Termination Dates"
CaptionDataField="Id" EditFormType="Template" PopUpSettings-Modal="true" PopUpSettings-Width="663">
<EditColumn InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif" CancelImageUrl="Cancel.gif" FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
<FormTemplate>
<table id="tblEdit" runat="server" width="663" style="margin: 24px; border-radius: 20px;" cellpadding="6" >
<tr>
<td colspan="1" class="BodyText" width="31%" >Employee: </td>
<td colspan="1" width="69%">
<asp:TextBox runat="server" CssClass="TextField1" ID="txtName" ReadOnly="True"></asp:TextBox></td>
</tr>
<tr>
<td colspan="1" class="BodyText" width="31%">Type:</td>
<td colspan="1" width="69%">
<asp:DropDownList runat="server" ID="ddlType" CssClass="DropDown1" onchange="changeType(this)">
<asp:ListItem Value=""></asp:ListItem>
<asp:ListItem Value="H">Hire</asp:ListItem>
<asp:ListItem Value="T">Termination</asp:ListItem>
<asp:ListItem Value="E">PEO</asp:ListItem>
<asp:ListItem Value="N">PEO Termination</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvReq1" runat="server" CssClass="Heading1" ControlToValidate="ddlType" ErrorMessage="* Required"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td colspan="1" class="BodyText" width="31%">Action/EffectiveDate:</td>
<td colspan="1" width="69%">
<telerik:RadDatePicker runat="server" ID="rdpActionDate"></telerik:RadDatePicker>
<asp:RequiredFieldValidator ID="rfvReq2" runat="server" CssClass="Heading1" ControlToValidate="rdpActionDate" ErrorMessage="* Required"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="1" class="BodyText" width="31%">Reason For Termination:</td>
<td colspan="1" width="69%">
<asp:DropDownList runat="server" ID="ddlTermReason" CssClass="DropDown1">
</asp:DropDownList> <asp:RequiredFieldValidator ID="rfvReq3" CssClass="Heading1" runat="server" ControlToValidate="ddlTermReason" ErrorMessage="* Required"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="BodyText" width="31%">Memo:</td>
<td width="69%">
<asp:TextBox runat="server" ID="txtMemo" TextMode="MultiLine" Height="86px" Width="346px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button runat="server" ID="txtSave" CommandName="Update" CssClass="Buttons" Text="Save" />
<asp:LinkButton runat="server" ID="btnCancel" CssClass="Link_Cancel" Text="Cancel" CommandName="Cancel" CausesValidation="False"></asp:LinkButton>
</td>
</tr>
</table>
</FormTemplate>
<PopUpSettings Modal="True" Width="663px" >
</PopUpSettings>
</EditFormSettings>
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
<CommandItemTemplate>
<table width="100%" cellpadding="10">
<tr>
<td align="left">
<asp:Button runat="server" ID="btnAdd" CommandName="InitInsert" Text="Add New Record" CssClass="Buttons" /></td>
<td align="right">
<asp:LinkButton runat="server" CommandName="Export" ID="lbtnExport" Text="Export"><img src="../images/excel.jpg"/> Export</asp:LinkButton></td>
</tr>
</table>
</CommandItemTemplate>
</MasterTableView>
<ClientSettings>
<ClientEvents OnPopUpShowing="PopUpShowing" />
</ClientSettings>
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
<FilterMenu EnableImageSprites="False" EnableEmbeddedSkins="False"></FilterMenu>
<HeaderContextMenu EnableEmbeddedSkins="False"></HeaderContextMenu>
</telerik:RadGrid>