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

RadGrid_InsertCommand

1 Answer 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jai
Top achievements
Rank 1
Jai asked on 12 Jul 2011, 05:15 AM
Hi,

I want to extract the values of the columns on InsertCommand and i am not able to fatch then. I am doing as below
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
        {
                GridDataInsertItem insertItem;
                insertItem = (GridDataInsertItem)RadGrid1.MasterTableView.GetInsertItem();
         }

In above code, always i am getting null insertItem object. Why ? Can anyone tell me how to get the Inserted Values in grid columns on InsertCommand ?

I am using objectDataSource to Bind the grid. not binding on CodeBehind. I have SelectCommand in that objectDataSource.

Thanks,
--Jai

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Jul 2011, 08:12 AM
Hello Jai,

Try the following code snippet in InsertCommand to access the inserted item.

C#:
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
        if (e.Item is GridDataInsertItem  && e.Item.OwnerTableView.IsItemInserted)
        {
            GridDataInsertItem  insertItem = (GridDataInsertItem) e.Item; ;
            insertItem = (GridDataInsertItem) RadGrid1.MasterTableView.GetInsertItem();
            TextBox txtbx = (TextBox)insertItem["ColumnUniqueName"].Controls[0];
            string id = txtbx.Text;
        }
}

Thanks,
Princy.
Tags
Grid
Asked by
Jai
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or