Link to home
Create AccountLog in
Avatar of dynamicweb09
dynamicweb09Flag for India

asked on

Findcontrol within a placeholder within Gridview

I have a gridview,within the gridview i have added PlaceHolder.Within the placeholder i am adding controls like(Textbox,dropdown etc) dynamically. but I am not able to find those control while saving the data.
I am attaching some code
code.txt
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

You cannot FindControl method to get the placeholder as it returns null. You need to access the Cell property to use FindControl:
PlaceHolder pl = (PlaceHolder)gvresult.Rows[i].Cell[1].FindControl("plcontrol");

Open in new window



If you need more help, please post markup.

Off topic/Leads to new question if more details required: Why are you using a place holder? What about using templates
Avatar of dynamicweb09

ASKER

I am adding controll into gridview dynamically that is why i have used PlaceHolder . Is there any other way to add controll dynamically into Gridview.
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
hi.. plz try the following text file example.
code.txt