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;