Hide menu is not working in asp.net page
i want to hide the HR menu once user login into the login page.Once user logged in it will redirect to Employee.aspx page
In Employee.aspx page all menus are visible.
I want to hide the HR menu in Employee.aspx page.
I written my code as follows to hide the HR menu in Employee.aspx page
i written my below code in login.aspx.cs page My code as follows
if (txtuser.Text == "admin")
{
string url = HttpContext.Current.Request.Url.AbsoluteUri;
if (url == "http://localhost:65742/HRMS/Employee.aspx")
{
Menu mainMenu = (Menu)Page.Master.FindControl("Menu1");
mainMenu.Items.Remove(mainMenu.FindItem("HR"));
mainMenu.Visible = false;
}
}
but when i run the above code in Employee.aspx page HR Menu is not visible false.
from my above code what is the mistake.
Please let me know.