-6

i need to access the user control elements such as textbox from parent control.Its showing the error " 'user control' element does not exist in the current context".I cannot access the user control elements??

Karthik
  • 85
  • 1
  • 11

1 Answers1

0

Let me guess, I think you are trying to get the scope of any control (textbox) which is located inside any other server side view like GridView? You can try this way:

        GridViewRow gvr = (GridViewRow)(((Control)sender).NamingContainer);
        TextBox _selectedStorageLocation = (TextBox)gvr.FindControl("txtName");

Take a look at this thread as well.

Community
  • 1
  • 1
Abhimanyu
  • 2,173
  • 2
  • 28
  • 44