当前位置:编程学习 > C#/ASP.NET >>

datagrid的编辑按钮无响应

我的datagrid中得编辑按钮点击下去没反应,不知道为什么,请大家帮帮忙

<asp:GridView ID="GridViewBrowsing" runat="server" Width="900px" Font-Size="12px" AutoGenerateColumns="false" PageSize="25" AllowPaging="true" CssClass="GridViewStyle" OnRowDeleting = "GridViewBrowsing_RowDeleting" OnRowEditing ="GridViewBrowsing_RowEditing" HorizontalAlign="Center" OnPageIndexChanging="GridViewBrowsing_PageIndexChanging"> 
                        <Columns>
                            <asp:BoundField DataField = "isborrow" HeaderText = "状态" />
                            <asp:BoundField DataField = "remark" HeaderText = "简介" />
                            <asp:CommandField  ShowEditButton="true" ButtonType="Link" HeaderText="编辑" />
                            <asp:CommandField ShowDeleteButton="true" HeaderText="删除"  DeleteText="<div id="de" onclick="JavaScript:return confirm('你确定要删除?')">删除</div>" /> 
                        </Columns>
                        <FooterStyle CssClass="FooterStyle" />
                        <RowStyle CssClass="RowStyle" />
                        <EmptyDataRowStyle CssClass="EmptyRowStyle" />
                        <PagerStyle CssClass="PagerStyle" />
                        <SelectedRowStyle CssClass="SelectedRowStyle" />
                        <HeaderStyle CssClass="HeaderStyle" />
                        <EditRowStyle CssClass="EditRowStyle" />
                        <AlternatingRowStyle CssClass="AltRowStyle" />
                        <PagerTemplate>
                            <asp:Label ID="lblCurrentPage" runat="server" ForeColor="Red" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Label>/
                            <asp:Label ID="lblPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount %>"></asp:Label>
                            <asp:LinkButton ID="lbtnFirstPage" runat="server" CommandArgument="First" CommandName="Page"
                                ForeColor="Black" Visible="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">首页</asp:LinkButton>
                            <asp:LinkButton ID="lbtnPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page"
                                ForeColor="Black" Visible="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">上一页</asp:LinkButton>
                            <asp:LinkButton ID="lbtnNextPage" runat="server" CommandArgument="Next" CommandName="Page"
                                ForeColor="Black" Visible="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">下一页</asp:LinkButton>
                            <asp:LinkButton ID="lbtnLastPage" runat="server" CommandArgument="Last" CommandName="Page"
                                ForeColor="Black" Visible="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">尾页</asp:LinkButton>
                        </PagerTemplate>
                    </asp:GridView> --------------------编程问答-------------------- 加事件了吗?

    protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
    {
        gv.EditIndex=e.NewEditIndex;
        BindData();
    }
--------------------编程问答-------------------- 请问你是在rowcommand事件里做的吗? 
还是 用控件自带的编辑?
--------------------编程问答-------------------- <EditItemTemplate >
<asp:TextBox id="txt" MaxLength="100" runat="server" Text='<%# Eval("NAME") %>' Width="86%">
</asp:TextBox>
</EditItemTemplate>
 protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
  {
  this.gv.EditIndex = e.NewEditIndex;
  BindData();
  }

  protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e)
  {
  this.gv.EditIndex = e.RowIndex;
  int id = int.Parse(this.gv.DataKeys[e.RowIndex].Value.ToString());
  string str = ((TextBox)this.gvTarget.Rows[e.RowIndex].FindControl("txt")).Text.Trim();
    
  this.gv.EditIndex = -1;
  BindData();
  }
  <asp:LinkButton ID="LinkButton1" runat="server" CommandName="edit" CausesValidation="false" OnClientClick="return confirm('确认要编辑吗?');">编辑</asp:LinkButton>  --------------------编程问答-------------------- 能不能详细描述一下事发现场以及事发过程
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,