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

Need to find RadNumericTextBox in Edit FormTemplate

2 Answers 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Y
Top achievements
Rank 2
Steve Y asked on 22 Sep 2008, 07:02 AM
I have a Grid with an Edit FormTemplate which has six controls of Type RadNumericTextBox all sitting inside a table.

The grid goes into edit mode and, as each textbox has data entered into it, I need to be able to find the other five, get their values and keep a running total which I'll be displaying elsewhere on the page. I have the grid ajaxified and each control has autopostback="true". I have the onTextChanged event for each textbox wired and I'm seeing each control fire in code behind.

So far so good. However, I cannot find the other five textboxes. So far in the research I've done, I see many examples of using grid events such as editing and inserting etc which gives an easy path to find the controls using:

GridEditFormItem item = e.Item as GridEditFormItem;

However, all I have is either the sender as my RadNumericTextBox or RadGrid1 as a starting point for any contained controls.

Can anyone help point me in the right direction.

Thanks, Steve

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 22 Sep 2008, 07:35 AM
Hi Steven,

You can use OnTextChanged server-side event where you can cast sender argument to RadNumericTextBox and find the grid item using NamingContainer property:

GridItem item = (
GridItem)((RadNumericTextBox)sender).NamingContainer;

Now you can use FindControl() for GridItem to find desired control by ID.

Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Steve Y
Top achievements
Rank 2
answered on 22 Sep 2008, 07:49 AM
Thanks Vlad. That works great.
Tags
Grid
Asked by
Steve Y
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Steve Y
Top achievements
Rank 2
Share this question
or