TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Petro Tiburcio
NA
15
15.9k
Show/hide sitemap if user is logged in
Jun 9 2013 4:29 AM
I have a log in page, code behind is below:
protected void btnLog_Click(object sender, EventArgs e)
{
SqlConnection conn1 = new SqlConnection("Data Source=GATE-PC\\SQLEXPRESS;Initial Catalog=dbUsers;Integrated Security=True");
conn1.Open();
SqlCommand cmdd = new SqlCommand("select * from Users where UserName = @user AND Password = @pass", conn1);
SqlParameter param = new SqlParameter();
SqlParameter param1 = new SqlParameter();
param.ParameterName = "@user";
param1.ParameterName = "@pass";
param.Value = txtuser.Text;
param1.Value = txtpass.Text;
cmdd.Parameters.Add(param);
cmdd.Parameters.Add(param1);
SqlDataReader reader = cmdd.ExecuteReader();
if (reader.HasRows)
{
reader.Read();
MessageBox("Login Successful");
clear();
}
else
{
MessageBox("Invalid Username/Password");
}
}
I have two sitemaps:
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu"
EnableViewState="False" IncludeStyleBlock="False" Orientation="Horizontal"
DataSourceID="SiteMapDataSource1" StaticDisplayLevels="2"
onmenuitemdatabound="NavigationMenu_MenuItemDataBound">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<div class="clear hideSkiplink">
<asp:Menu ID="Menu1" runat="server" CssClass="menu"
EnableViewState="False" IncludeStyleBlock="False" Orientation="Horizontal"
DataSourceID="SiteMapDataSource2" StaticDisplayLevels="2"
onmenuitemdatabound="NavigationMenu_MenuItemDataBound">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource2" runat="server" SiteMapProvider="AdminSiteMapProvider"/>
what i want to achieve is when a user is not logged in Menu1 will display and NavigationMenu will hide but if a user is logged in Menu1 will hide then NavigationMenu will show. Kindly help me with this. I'm using asp.net with c#. Thanks and God Bless
Reply
Answers (
0
)
ASP.NET MVC Question
ASP.NET Gridview textbox autocomplete