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

[Solved] Find update event for user control in rad grid

2 Answers 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Awadh .
Top achievements
Rank 1
Awadh . asked on 12 Nov 2009, 04:56 AM
I need to find the update event for other recreate user control(on click of OK button) similar to update user control(as on click of UPDATE button) in the grid from the code behind. Concerned image file illustrating this has been attached with this post.


if (e.CommandName == RadGrid.UpdateCommandName) 
            { 
                UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); 
                RadTextBox txtOrderValue = userControl.FindControl("txtOrderValue"as RadTextBox; 

 
These user controls are loading in grid as the user hits concerned image buttons in the grid.



Thanks,
Awadh

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 12 Nov 2009, 07:05 AM
Hello,

You can set the CommandName and CommandArgument of the Ok button as shown and then try the following code:
ascx:
<asp:Button ID="Button1" runat="server" Text="OK" CommandName="Update" CommandArgument="OK" /> 

c#:
 protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == RadGrid.UpdateCommandName) 
        { 
            UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); 
            if (e.CommandArgument.ToString() == "OK"
            {                
                RadTextBox txtbx = userControl.FindControl("RadTextBox1"as RadTextBox;  
            } 
            else 
            {                 
                RadTextBox txtOrderValue = userControl.FindControl("txtOrderValue"as RadTextBox;  
            } 
        }    
    } 

Thanks
Princy.
0
Awadh .
Top achievements
Rank 1
answered on 12 Nov 2009, 10:03 AM
Thanks Princy,

I was able to solve the problem with your help. Now i feel much comfortable with using the rad grid.


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