Hide menu item for user

Last Reply on Sep 29, 2012 11:46 PM By BigHeart

Posted on Sep 17, 2012 04:58 AM

i want to restrict some menu item for user .  the menu item is in master page and there is one login for admin and user .. i have 

transaction

search

reports

usr profile

i want to hide user profile for user .... how can i do it..???


You are viewing reply posted by: BigHeart on Sep 29, 2012 11:46 PM.
Posted on Sep 29, 2012 11:46 PM

i have done it like this .. i took two master age one only for login and another have al pages . then i treid this code it work fine 

  protected void Page_Load(object sender, EventArgs e)
        {



            con.Open();
            Label1.Text = Session["name"].ToString();
            string s = "SELECT name,password FROM admin" + " WHERE name='" + Label1.Text + "'";
            SqlCommand cmd = new SqlCommand(s, con);
            SqlDataReader Dr = cmd.ExecuteReader();
            if (Dr.Read())
            {
                Menu4.Visible = true;
                con.Close();
            }
            else
            {

                con.Close();
                con.Open();
                String q = "SELECT Name,Password FROM user2 " + " WHERE Name='" + Label1.Text + "'";
                SqlCommand cmnd = new SqlCommand(q, con);
                SqlDataReader Dr1 = cmnd.ExecuteReader();
                if (Dr1.Read())
                {
                    Menu1.Visible = true;
                    con.Close();
                }
                else
                {
                    Menu4.Visible = true;
                }

            } 
            }