views:

17

answers:

1

i have a datalist control

        <ItemTemplate>
                <asp:Label ID="lblAddressID" runat="server" Text='<%# Bind("StudentName") %>'/>
                <asp:Label ID="lbl" runat="server" />
                <asp:Button runat="Server" ID="cmdEdit" CommandName="Edit" Text="Edit"/>
        </ItemTemplate>

        <EditItemTemplate>  
                <asp:TextBox ID="txtAddressID" runat="server" Text='<%# Bind("StudentName") %>' BackColor="#FFFF66" />        
             <%--   <asp:Label ID="lbl" runat="server"/>
                <asp:Button runat="Server" ID="cmdUpdate" CommandName="Update" Text="Update" />
                <asp:Button runat="Server" ID="cmdCancel" CommandName="Cancel" Text="Cancel"/>--%>
        </EditItemTemplate>
   </asp:DataList>

and during page load im binding the datas:

protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataTable dt = new DataTable();
            dt = obj.GetDatas();

            DataList1.DataSource = dt;
            DataList1.DataBind();
        }

    }

now i received the datas binded to the control. i need to update my datas in edit mode.

How to carry out edit mode to update datas in Datalist control ??

any help...

A: 

have look at this sample

EditItemTemplate and DataList

source code:

DataList3_cs.aspx

Asad Butt