This is a migrated thread and some comments may be shown as answers.

[Solved] invoking a function on clicking update button in GridEditcommandcolumn

5 Answers 496 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Siva
Top achievements
Rank 1
Siva asked on 18 Mar 2013, 11:25 AM
Hi ,
         I am having  a grid with a GridEditcommand column when i press the edit button update & cancel button shows up. on clicking the update button a function from (.cs file) must be invoked so that i can update the table. Please help me with a sample code. Also once i clicked edit the grid must come back to normal mode .... 

5 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 18 Mar 2013, 11:35 AM
Hi,

You can update the table in UpdateCommand event as shown below.
C#:
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{//update the table
}

Thanks,
Shinu
0
Siva
Top achievements
Rank 1
answered on 18 Mar 2013, 01:28 PM
hi i have to fetch a drop down list value, a textbox value & a bound column value on the row i am editing . help me with a code... I think this update command is not firing..
0
Shinu
Top achievements
Rank 2
answered on 19 Mar 2013, 04:16 AM
Hi,

Try the following.
C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem item = (GridEditFormItem)e.Item;
            TextBox TextBox1 = (TextBox)item.FindControl("TextBox1");
            DropDownList ddl = (DropDownList)item.FindControl("DropDownList1");
            string value = ddl.SelectedItem.Text;
            TextBox txt = (TextBox)item["Uniquename"].Controls[0];
            string boundcolumnvalue = txt.Text;
        }
}

Thanks,
Shinu
0
Siva
Top achievements
Rank 1
answered on 19 Mar 2013, 06:52 AM
how can i fetch the boundcolumn value of the current edit row on clicking Update button. the bound column value is not in edit mode, it is set to read only.. pls help me with a code..
0
Shinu
Top achievements
Rank 2
answered on 20 Mar 2013, 04:53 AM
Hi,

Try setting the ReadOnlyColumn as the DataKeyName of the gridtableview and access the value.
C#:
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
         GridEditableItem editItem = (GridEditableItem)e.Item;
            string value = editItem.GetDataKeyValue("Id").ToString();
}

Thanks,
Shinu
Tags
Grid
Asked by
Siva
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Siva
Top achievements
Rank 1
Share this question
or