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

RAD GRID VALUES in EDIT FORM ASCX POPUP

2 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35) asked on 22 Sep 2011, 03:33 PM
Hi Everybody,

I have used a radgrid with ascx usercontrol for insert and edit, my edit mode is popup.

On edit command i need to assign the seleted row values to the controls in the usercontrol(ascx) and display in the popup.

Is there a way to refer the rad grid from the usercontrols cs page on edit command click?

Please give me suggestions.

Thank You,


2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 23 Sep 2011, 06:21 AM
Hello Anto,

You can access the usercontrol like below and can access the desited control by using findControl method.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
  {
      if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
      {
          UserControl MyUserControl = e.Item.FindControl(GridEditFormItem.EditFormUserControlID) as UserControl;
          TextBox txt = (TextBox)MyUserControl.FindControl("TextBox1");
          txt.Text = "Test";
      }
  }

Thanks,
Shinu.
0
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
answered on 23 Sep 2011, 08:35 AM
Hi Shinu,

Thank You for you response.

I got it working.

The method you posted is working fine,

another way to do this as follows 

TextBox1.Text = DataBinder.Eval( This.Parent.NamingContainer, "DataItem.UserName").ToString();

This can be done in the code behind page(.cs) of the user control (ascx). Both works fine for me.

Thank You,
Tags
Grid
Asked by
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 1
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Share this question
or