Asp.net get value from Textbox in aspx to code behind Asp.net get value from Textbox in aspx to code behind asp.net asp.net

Asp.net get value from Textbox in aspx to code behind


This is because these controls are parts of a template. They are not directly on the page, they are added there dynamically when Login control is initialized. To access them you need FindControl:

string user = ((TextBox)Login1.FindControl("UserName")).Text;