我有一个包含编辑按钮的网格。当我单击编辑按钮并进行调试时,它不会命中选定的索引更改事件。没有构建错误
网格后面的代码
public void btnModemDetailsEdit_Click(object sender, EventArgs e)
{
isEdit = true;
}
protected void gridModemDetails_SelectedIndexChanged(object sender, EventArgs e)
{
int id = Convert.ToInt32(GridModemDetails.DataKeys[GridModemDetails.SelectedIndex].Values["gridModemDetails_SelectedIndexChanged"].ToString());
}
<asp:GridView ID="GridModemDetails" runat="server" Width="435px"
DataKeyNames="ModemId" AllowPaging="True"
OnSelectedIndexChanged="gridModemDetails_SelectedIndexChanged"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="Edit" Visible="True" >
<ItemTemplate>
<asp:LinkButton ID="btnModemDetailsEdit"
AccessibleHeaderText="Edit"
ButtonType="Button"
Text="Edit"
HeaderText="Edit"
runat="server"
OnClick="btnModemDetailsEdit_Click"/>
</ItemTemplate>
</asp:TemplateField>