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

How to access controls in a nestedViewTemplate in the event ItemCommand?

1 Answer 158 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gregory
Top achievements
Rank 2
Gregory asked on 16 May 2016, 09:02 PM

Hello,

As the title says it, I would like to know how to get the value of a text box in my nestedViewTemplate while I am in the ItemCommand event.

When I cast the Telerik.Web.UI.GridCommandEventArgs e to a GridNestedViewItem, it says the cast is wonrg. If I cast it to GridDataItem, then my text box is after I used FindControl("myTextBoxID")

What would be the way to do that please?

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Gregory
Top achievements
Rank 2
answered on 17 May 2016, 04:45 PM

I found the answer myself:

TextBox tbMessage = (e.Item as GridDataItem).ChildItem.FindControl("tbMessage") as TextBox;

Tags
General Discussions
Asked by
Gregory
Top achievements
Rank 2
Answers by
Gregory
Top achievements
Rank 2
Share this question
or