Editing control inside Row Edit Template

984 views Asked by At

Hello, I'm currently trying to load data into one of the RowEditTemplate's controls.

I have a regular ASP.NET DropDownList inside said template. This list should be loaded with data from a List, where MyObject has an Id and a Name.
I've been searching for quite some time now and I don't seem to be able to find a way to get this list from the code behind and load said data.

Any help is welcome, thank you

1

There are 1 answers

0
codingTornado On BEST ANSWER

Ok, as expected coming from lady luck(?), a little while after asking this I found the answer.

In order to get a control from inside the RowEditingTemplate you first need to get access to the Template in question. So, to answer my own question, in order to get my list I did:

DropDownList ddlMyObjects = (DropDownList)WebDataGrid1.Behaviors.EditingCore.Behaviors.RowEditTemplate.TemplateContainer.FindControl("control_MyObject");