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

[Solved] Get updated value of Radgrid autogenerated column

4 Answers 214 Views
Grid
This is a migrated thread and some comments may be shown as answers.
blue123
Top achievements
Rank 1
blue123 asked on 30 Nov 2009, 02:21 PM
I have a radgrid with autogeneratedcolumns="true". I have an edit column and a delete column to update and delete values from the grid. The problem is that I want to do it on server side like first read the updated values and then store them in the database. How can I achieve that? The columns are autogenerated so I am not able to read radgrid in RadGrid1_UpdateCommand.

4 Answers, 1 is accepted

Sort by
0
blue123
Top achievements
Rank 1
answered on 30 Nov 2009, 02:46 PM
anybody?
0
Princy
Top achievements
Rank 2
answered on 30 Nov 2009, 03:07 PM
Hello,

You can access the AutoGeneratedColumn fields using their UniqueNames which is the same as their datafield names in the database. Here's an example:
c#:
 protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)  
    {  
       if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))  
        {  
            GridEditableItem edititem = (GridEditableItem)e.Item;  
            string strtxt1 = (TextBox)edititem["DataField1Name"].Controls[0]).Text;  
            string strtxt2 = (TextBox)edititem["DataField2Name"].Controls[0]).Text;  
            //update query 
        }  
    }  

Thanks
Princy.
0
blue123
Top achievements
Rank 1
answered on 30 Nov 2009, 03:52 PM
Thanks Princy but the problem is that my radgrid will be showing different datatables. I am using a stored procedure to bring different datatables on radgrid.
0
Mira
Telerik team
answered on 03 Dec 2009, 04:16 PM
Hello Kavita,

Please try using the ExtractValuesFromItem method as shown in the first example of this help topic to achieve the desired by you functionality.

All the best,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
blue123
Top achievements
Rank 1
Answers by
blue123
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Mira
Telerik team
Share this question
or