【发布时间】:2016-08-05 21:51:26
【问题描述】:
火狐:
当 buttonField 被点击时,我检查OnRowCommand,我看到commandName 等于“Activar”,这是正确的。
Chrome 和 IE:
单击按钮时,commandName 等于“选择”,这是不正确的。
我在SelectedIndexChanged 的第一行也有一个断点,并且在 FF 上从未命中,在 Ch 和 IE 上它确实命中,这意味着按钮单击事件没有触发
我在跑步:
- VS12(最新版本中也出现问题)
- .NET 框架 4.0
GridView:
<asp:GridView ID="gvNombreEmp" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource10"
style="margin-left:auto; margin-right:auto; width:100%" CssClass ="table"
AllowPaging="True" AllowSorting="True" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px"
CellPadding="2" ForeColor="Black" GridLines="None" OnRowDataBound ="gvNombreEmp_RowDataBound"
OnDataBound ="gvNombreEmp_DataBound" OnSelectedIndexChanged ="gvNombreEmp_SelectedIndexChanged"
OnPageIndexChanging ="gvNombreEmp_PageIndexChanging" OnRowCommand ="gvNombreEmp_RowCommand">
<AlternatingRowStyle BackColor="PaleGoldenrod" />
<Columns>
<asp:BoundField DataField="NumeroControl" HeaderText="Número Control" >
<HeaderStyle Font-Size="13pt" />
<ItemStyle Font-Size="12pt" />
</asp:BoundField>
<asp:BoundField DataField="NombreEmpresa" HeaderText="Nombre Empresa" >
<HeaderStyle Font-Size="13pt" />
<ItemStyle Font-Size="12pt" />
</asp:BoundField>
<asp:BoundField DataField="FC" HeaderText="Fecha Comienzo" >
<HeaderStyle Font-Size="13pt" />
<ItemStyle Font-Size="12pt" />
</asp:BoundField>
<asp:BoundField DataField="FE" HeaderText="Fecha Expiración" >
<HeaderStyle Font-Size="13pt" />
<ItemStyle Font-Size="12pt" />
</asp:BoundField>
<asp:BoundField DataField="EST" HeaderText="Estatus" >
<HeaderStyle Font-Size="13pt" />
<ItemStyle Font-Size="12pt" />
</asp:BoundField>
<asp:ButtonField CommandName ="Activar" ButtonType="Button" Text ="Desactivar" />
</Columns>
<FooterStyle BackColor="Tan" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<PagerStyle BackColor="Tan" Font-Size ="Large" ForeColor="DarkSlateBlue" Font-Bold ="true"/>
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<SortedAscendingCellStyle BackColor="#FAFAE7" />
<SortedAscendingHeaderStyle BackColor="#DAC09E" />
<SortedDescendingCellStyle BackColor="#E1DB9C" />
<SortedDescendingHeaderStyle BackColor="#C2A47B" />
</asp:GridView>
行命令:
switch(e.CommandName)
{
case "Activar":
break;
}
【问题讨论】: