View Single Post
Old January 28th, 2006, 08:22 AM
sands.msk sands.msk is offline
Registered User
Join Date: Jan 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

hai bibin
   i think you are just started using the datagrid. from the posting nobody can recognise what the real proble is. Any way u can use the asptemplate coloumn

<asp:TemplateColumn HeaderText="Name">
        <asp:TextBox id="txtName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>' />

use these codes in ur datagrid "Name" is the field in table to update.

int update function


void btnUpdate_click(Object sender, EventArgs e) {

    string strName = "";
        for (int i=0; i<MyDataGrid.Items.Count; i++) {

            DataGridItem _item = MyDataGrid.Items[i];
            TextBox txtName = (TextBox)_item.FindControl("txtName");

           strName = txtName.Text.toString().Tirm();
        //here you can write the query to update the database

    // after updation bind the grid again