0

我看过很多关于 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")
         {

         }
     }
4

1 回答 1

0

你的代码对我来说似乎很好。

是否需要使用 IE 10 来运行和调试您的系统?否则,你可能会考虑使用 IE 9 或更低版本,或者使用不同的浏览器来运行你的系统,因为我在我的 asp.net 项目中使用 IE 10 时遇到了几个代码和 asp 控制问题

于 2013-10-16T05:50:01.547 回答