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

Passing Value to usercontrol from Grid_ItemCommand Event when grid is in EditMode

2 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Priya
Top achievements
Rank 1
Priya asked on 23 Jul 2008, 09:56 AM

Sir
I want to load a value on the radtextbox which is in Usercontrol.
When the user clicks on the Edit button in the RadGrid on the aspx page,some value have tobe loaded in the usercontrol's radtextbox.That value is not included in Grid's datasource,instead it is taken from another dataset.So i need to pass the value to usercontrol which is in RadGrid

Plz help me...
thank you.

2 Answers, 1 is accepted

Sort by
0
irfan rizvi
Top achievements
Rank 1
answered on 23 Jul 2008, 10:15 AM
You need to use the ItemCommand Eventhandler, this will be called when edit is pressed,

In this event handler write the code to set the value of your text box
0
Princy
Top achievements
Rank 2
answered on 23 Jul 2008, 11:15 AM
Hello Priya,

You can check out the following code snippet and see if it helps.
cs:
 string Strtxt; 
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) 
        { 
 
            GridEditFormItem editItem = (GridEditFormItem)e.Item; 
            UserControl userControl = (UserControl)editItem.FindControl(GridEditFormItem.EditFormUserControlID); 
            RadTextBox rdtxbx = (RadTextBox)userControl.FindControl("RadTextBox1"); 
            rdtxbx.Text = Strtxt
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Priya
Top achievements
Rank 1
Answers by
irfan rizvi
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or