我看过很多关于 gridview row 命令未触发的帖子,但没有看到任何依赖于浏览器的帖子。
在 IE 10 中不会触发 Gridview 行命令。同一页面在 Chrome 和 Firefox 中完美运行。在 IE 中,即使是 Page_Load 在回发期间也不会被调用。我在调试模式下使用它的 Visual Studio 2012。我已清除缓存,重新启动 VS,甚至重新启动。
aspx 代码是:
<asp:gridview id="gvInstances" runat="server" AutoGenerateColumns="False"
ShowHeader="False" onrowcommand="gvInstances_RowCommand" BackColor="white" BorderColor="#cccccc" BorderStyle="solid" BorderWidth="1px" CellPadding="3" >
<Columns>
<asp:ButtonField Text="Select" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#cccccc" ItemStyle-BorderWidth="1px" ButtonType="Button" CommandName="Select" >
<ControlStyle CssClass="grdvwButton" />
</asp:ButtonField>
<asp:BoundField DataField="name" />
</Columns>
</asp:gridview>
而 aspx.cs 代码是:
public partial class SelectInstance : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
gvInstances.DataSource = SessionConfig.Instances;
gvInstances.DataBind();
}
}
protected void gvInstances_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
}
}