954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Findcontrol in gridview inside repeater inside another repeater

Hi guys,

I'm having some trouble finding a control... that is because this control is on gridview witch is inside repeater (let's call it rpt1) and this repeater is inside another repeater (this one, rpt2).. I have an ItemCommand on rpt1 witch I need to catch a dropdownlist item value that is created as an item template inside the gridview... but just can't find it..

I have tryed something like this:

DropDownList ddlPersons = (DropDownList)e.item.FindControl("ddlPersons");


and also even this:

DropDownList ddlPersons = (DropDownList)this.Page.FindControl("ddlPersons");


But no luck with both ways.. does anyone knows how can I find my control?

Cheers

icedome
Newbie Poster
18 posts since Jul 2010
Reputation Points: 11
Solved Threads: 1
 

Well... my first post has just been solved... I've forgot to include the row in the findcontrol... the code should be like this:

DropDownList ddlPersons = (DropDownList)gridview1.Rows[0].FindControl("ddlPersons"); // of course, that the number inside the Rows[] is the row index

Hope that this could be useful to someone :)

icedome
Newbie Poster
18 posts since Jul 2010
Reputation Points: 11
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: