Click here to Skip to main content
15,902,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using Asp.net 2008.
I have a masterpage called Masp.It has a textbox named txtUsername.And I have a page Main.aspx use Masp.How do I can set txtUsername = username and get its value after logging in?
A textbox on the page named Main.aspx will get value from txtUsername.
Posted

1 solution

Finding MasterPAge Control in Child Page


TextBox txtuser=(TextBox)Page.Master.FindControl("txtUserName");
and you can use txtuser as your wish
 
Share this answer
 
Comments
giatuan2011 17-May-12 2:10am    
TextBox txtuser=(TextBox)Page.Master.FindControl("txtUsername");
txtuser.Text="John";
I can set it.When I add textbox into ContentPlaceHolder,I can not set value of txtUsername to textbox

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900