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 77 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:53 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
Tsvetoslav
Telerik team
answered on 16 Nov 2009, 02:22 PM
Hello Awadh .,

Unfortunately, based on your description I was not able to understand what you are targeting at with your implementation, neither were the files mentioned attached. Could you provide a more detailed explanation of your scenario.

Thanks.

Regards,
Tsvetoslav
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.
0
Awadh .
Top achievements
Rank 1
answered on 17 Nov 2009, 07:29 AM
Hi,

Thanks to Telerik team for response to my post.
I got my problem solved with help of clue provided by PRINCY in response to my post.
Thanks princy for providing valuable solution on the time.


From: Princy
Date: 11/12/2009 1:05:01 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.
Tags
Grid
Asked by
Awadh .
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Awadh .
Top achievements
Rank 1
Share this question
or