hi again
i have simple web form that is dependent on the login control of asp.net
here's a snapshot:
http://s279.photobucket.com/albums/kk137/wh3resmycar/?action=view¤t=login.jpg
i already have a loginview control working that says "Welcome back [user name]" ( in this case the user name is "new").
anyway, i need to get the value of the username to be inserted on to a table along with the other contact details.
i tried this method >>> "LoginView1.ClientID.ToString();"
but it didnt seem to work as i wasnt able to extract the value of the username.
// what i did was test if i can get the value and display it using a label first "Label1.Text = LoginView1.ClientID.ToString();"
didnt seem to work as the label displayed its default value.
any idea?
thanks in advance.
Loading
Lalit MPosted Nov 14, 2009, 1:07 PM
Mark UyPosted Nov 14, 2009, 12:21 PM
silly me i forgot that i was coding it onto another event.
thanks man.
Mark UyPosted Nov 14, 2009, 12:11 PM
Kirtan PatelPosted Nov 14, 2009, 12:10 PM
protected void Page_Load(object sender, EventArgs e)
{
string Username = User.Identity.Name;
Label1.Text = Username;
}
verify the code one again :)
Mark UyPosted Nov 14, 2009, 12:05 PM
i tried this:
string username = User.Identity.Name;
Label1.Text = username;
the label is still displaying its default values, which is "Label".
Mark UyPosted Nov 14, 2009, 12:02 PM
Kirtan PatelPosted Nov 14, 2009, 12:00 PM
you dont need to Get Value of Username From Login View as you can Get User name any time from anywere From membership class like below
string Username = User.Identity.Name;