Navigation Bar from database

Posted by KareemSaad on Stack Overflow See other posts from Stack Overflow or by KareemSaad
Published on 2010-04-01T12:40:43Z Indexed on 2010/04/01 12:43 UTC
Read the original article Hit count: 307

Filed under:

i had soulation .i want to make navigation bar with items i will select them as (category,Product,....) So i made stored to get them throught paramater will pass it,s value from query string as. ALTER Proc Navcategory ( @Category_Id Int ) As Select Distinct Categories.Category,Categories.Category_Id

From Categories Where Category_Id=@Category_Id

and i mentioned in cs as if (Request.QueryString["Category_Id"] != null) {

        Banar.ImageUrl = "Handlers/Banner.ashx?Category_Id=" + Request.QueryString["Category_Id"] + "";
        using
    (SqlConnection conn = Connection.GetConnection())
        {
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "Navcategory";
            cmd.Parameters.Add(Parameter.NewInt("@Category_Id", Request.QueryString["Category_Id"]));
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
            {
                LblNavigaton.Visible = true;
                LblNavigaton.Text = dr["Category"].ToString();

            }

        }
    }

so the result will be ex. Fridge> (Category when querstring(category_Id)) 4Door> (Product when querystring (Product_Id))

But I want the result fridge>4Door>...>....

© Stack Overflow or respective owner

Related posts about c#