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

[Solved] Getting fields from RadGrid_ItemUpdated

1 Answer 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard Byrne
Top achievements
Rank 1
Richard Byrne asked on 12 Mar 2010, 06:08 PM
HI there,

I need to access the radgrid fields after an update event.

I thought this I could use either GridDataItem or GridEditableItem.
However, the code below just returns &nbsp into UserName and UserID.



protected void grdUsers_ItemUpdated(object source, GridUpdatedEventArgs e) 
    { 
        string userName; 
        string userID; 
 
        if (e.Item is GridEditableItem) 
        { 
            GridEditableItem gridEditDataItem = e.Item as GridEditableItem; 
             
            userName = gridEditDataItem["UserName"].Text; 
            userID = gridEditDataItem["UserID"].Text; 
        } 
 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem gridDataItem = e.Item as GridDataItem; 
             
            userName = gridDataItem["UserName"].Text; 
            userID = gridDataItem["UserID"].Text; 
        } 
    } 

What am I doing wrong?

Thanks for any help

Richard

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Mar 2010, 08:46 AM
Hi,

Please try the code snippet below and let me know how it goes.
C#
protected void RadGrid1_ItemUpdated(object source, GridUpdatedEventArgs e)   
        {   
            GridEditableItem item = (GridEditableItem)e.Item;   
            GridDataItem parentItem = (GridDataItem)item.ParentItem;   
            string strname = parentItem["UserName"].Text;   
         }  

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