<asp:DataList ID="DataList1" runat="server" CellSpacing="22" DataKeyField="PicID"
        OnCancelCommand="DataList1_CancelCommand" OnDeleteCommand="DataList1_DeleteCommand"
        OnEditCommand="DataList1_EditCommand" OnUpdateCommand="DataList1_UpdateCommand"
        RepeatColumns="4" RepeatDirection="Horizontal">
        <ItemTemplate>
            <asp:LinkButton ID="Edit" runat="server" CommandName="Edit">编辑</asp:LinkButton>&nbsp;
        </ItemTemplate> 
 <EditItemTemplate>         
            <asp:LinkButton ID="Update" runat="server" CommandName="Update">更新</asp:LinkButton>
            <asp:LinkButton ID="Cancel" runat="server" CommandName="Cancel">取消</asp:LinkButton>
            <asp:LinkButton ID="Delete" runat="server" OnClientClick="return confirm('你确定要删除吗?')" CommandName="Delete">删除</asp:LinkButton>
        </EditItemTemplate>
    </asp:DataList>看代码,我想实现点button按钮"编辑" 进入编辑状态  有"更新" "取消" 删除 这选项,不过不实现,老点编辑都进不了<EditItemTemplate> 这里面  DataList1.EditItemIndex =e.Item.ItemIndex;也不行

解决方案 »

  1.   

    是在这个事件里面写的吗  
    protected void DataList1_EditCommand(object source, DataListCommandEventArgs e)
      {
            DataList1.EditItemIndex = e.Item.ItemIndex;
            
        }
      

  2.   


       protected void gvStudent_RowEditing(object sender, GridViewEditEventArgs e)
            {
                this.gvStudent.EditIndex = e.NewEditIndex;
                Banding();        }        protected void gvStudent_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
            {
                this.gvStudent.EditIndex = -1;
                Banding();
            }
      

  3.   

    你飞的Button按钮的命名重复,俩个互相冲突,怎么能实现更能啊!把你的那个按钮的命名改一下
      

  4.   

    我解决了,用button不行  用linkbutton就可以了  不知道为什么用button控件点了没反应
      

  5.   

    我解决了,用button不行  用linkbutton就可以了  不知道为什么用button控件点了没反应
      

  6.   

    我解决了,用button不行  用linkbutton就可以了  不知道为什么用button控件点了没反应