RSS

Display Date Formate and User Name with Login Control

15 Sep

if you want to display date in this formate then use this code

lblDate.Text = DateTime.Now.ToString(“ddd”) + ‘ ‘ + DateTime.Now.Day.ToString() + ‘ ‘ + DateTime.Now.ToString(“MMMM”) + ‘ ‘ + DateTime.Now.Year.ToString();

you you want to display full day then just

DateTime.Now.ToString(“dddd”)

Login Control

write this code at master page.

if (HttpContext.Current.User.Identity.IsAuthenticated == true)
{

tvLeftNav.Visible = true;
loginImg.Visible = true;
}
else
{
tvLeftNav.Visible = false;
}

For display at Each Page top where user login then this code write at master page

<div>
<asp:loginview ID=”LoginView1″ runat=”server”>
<loggedintemplate>

<asp:loginname id=”LoginName1″ runat=”server” formatstring=”{0}” />

</loggedintemplate>

</asp:LoginView>
</div>

For Logout

<div>
<asp:LoginStatus ID=”LoginStatus2″ runat=”server”
LogoutAction=”RedirectToLoginPage” LogoutPageUrl=”~/login.aspx” LogoutImageUrl=”~/images/12_icon.png” LoginImageUrl=”~/images/12_icon.png” />

</div>

Advertisements
 
Leave a comment

Posted by on September 15, 2010 in ASP Dot Net C#

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: