Manual menu of linkbuttons
-
Hi, I've made a menu manually by creating linkbuttons, each time i click on a button, i get the rest of the items in this way. the menu was created in a MASTERPAGE! item 1 subitem11 item 2 subitem12 item 3 subitem13 item 4 and if i click on item 2 - what was before disappears and i get the subitems for item 2. and its working great. anyway, when i click on any of the items, i change the color of this item, then i Response.Redirect it to the desired page. when i redirect it to the page it loses all of the proporties i have set to this specific linkbutton. Is there anyway i can save those proporties each time i redirect to another page? here is the C# code i've made:
protected void LinkButton1_Click(object sender, EventArgs e)
{
this.LinkButton1.ForeColor = System.Drawing.Color.Red;
this.LinkButton2.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton3.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton4.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.ForeColor = System.Drawing.Color.DimGray;
this.sub2.ForeColor = System.Drawing.Color.DimGray;
this.sub3.ForeColor = System.Drawing.Color.DimGray;
this.sub4.ForeColor = System.Drawing.Color.DimGray;
this.sub5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.Visible = true;
this.sub1.Text = "BIOGRAPHY";
this.sub2.Visible = true;
this.sub2.Text = "DISTINCTIONS";
this.sub3.Visible = true;
this.sub3.Text = "EXHIBITIONS";
this.sub4.Visible = true;
this.sub4.Text = "LECTURES";
this.sub5.Visible = false;
this.asub1.Visible = false;
this.asub2.Visible = false;
this.asub3.Visible = false;
this.asub4.Visible = false;
this.asub5.Visible = false;
this.asub6.Visible = false;
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
this.LinkButton1.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton2.ForeColor = System.Drawing.Color.Red;
this.LinkButton3.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton4.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.ForeColor = System.Drawing.Color.DimGray;
this.sub2.ForeColor = System.Drawing.Color.DimGray;
this.sub3.ForeColor = System.Drawing.Color.Dim -
Hi, I've made a menu manually by creating linkbuttons, each time i click on a button, i get the rest of the items in this way. the menu was created in a MASTERPAGE! item 1 subitem11 item 2 subitem12 item 3 subitem13 item 4 and if i click on item 2 - what was before disappears and i get the subitems for item 2. and its working great. anyway, when i click on any of the items, i change the color of this item, then i Response.Redirect it to the desired page. when i redirect it to the page it loses all of the proporties i have set to this specific linkbutton. Is there anyway i can save those proporties each time i redirect to another page? here is the C# code i've made:
protected void LinkButton1_Click(object sender, EventArgs e)
{
this.LinkButton1.ForeColor = System.Drawing.Color.Red;
this.LinkButton2.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton3.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton4.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.ForeColor = System.Drawing.Color.DimGray;
this.sub2.ForeColor = System.Drawing.Color.DimGray;
this.sub3.ForeColor = System.Drawing.Color.DimGray;
this.sub4.ForeColor = System.Drawing.Color.DimGray;
this.sub5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.Visible = true;
this.sub1.Text = "BIOGRAPHY";
this.sub2.Visible = true;
this.sub2.Text = "DISTINCTIONS";
this.sub3.Visible = true;
this.sub3.Text = "EXHIBITIONS";
this.sub4.Visible = true;
this.sub4.Text = "LECTURES";
this.sub5.Visible = false;
this.asub1.Visible = false;
this.asub2.Visible = false;
this.asub3.Visible = false;
this.asub4.Visible = false;
this.asub5.Visible = false;
this.asub6.Visible = false;
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
this.LinkButton1.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton2.ForeColor = System.Drawing.Color.Red;
this.LinkButton3.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton4.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.ForeColor = System.Drawing.Color.DimGray;
this.sub2.ForeColor = System.Drawing.Color.DimGray;
this.sub3.ForeColor = System.Drawing.Color.DimWhy Link button ? Why not ASP.NET Menu ?
Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Why Link button ? Why not ASP.NET Menu ?
Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
ASP menu is more flexible than Link Buttons! but if you want to use LinkButtons, set it's style of selected in the page load event
-
Hi, I've made a menu manually by creating linkbuttons, each time i click on a button, i get the rest of the items in this way. the menu was created in a MASTERPAGE! item 1 subitem11 item 2 subitem12 item 3 subitem13 item 4 and if i click on item 2 - what was before disappears and i get the subitems for item 2. and its working great. anyway, when i click on any of the items, i change the color of this item, then i Response.Redirect it to the desired page. when i redirect it to the page it loses all of the proporties i have set to this specific linkbutton. Is there anyway i can save those proporties each time i redirect to another page? here is the C# code i've made:
protected void LinkButton1_Click(object sender, EventArgs e)
{
this.LinkButton1.ForeColor = System.Drawing.Color.Red;
this.LinkButton2.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton3.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton4.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.ForeColor = System.Drawing.Color.DimGray;
this.sub2.ForeColor = System.Drawing.Color.DimGray;
this.sub3.ForeColor = System.Drawing.Color.DimGray;
this.sub4.ForeColor = System.Drawing.Color.DimGray;
this.sub5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.Visible = true;
this.sub1.Text = "BIOGRAPHY";
this.sub2.Visible = true;
this.sub2.Text = "DISTINCTIONS";
this.sub3.Visible = true;
this.sub3.Text = "EXHIBITIONS";
this.sub4.Visible = true;
this.sub4.Text = "LECTURES";
this.sub5.Visible = false;
this.asub1.Visible = false;
this.asub2.Visible = false;
this.asub3.Visible = false;
this.asub4.Visible = false;
this.asub5.Visible = false;
this.asub6.Visible = false;
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
this.LinkButton1.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton2.ForeColor = System.Drawing.Color.Red;
this.LinkButton3.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton4.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.ForeColor = System.Drawing.Color.DimGray;
this.sub2.ForeColor = System.Drawing.Color.DimGray;
this.sub3.ForeColor = System.Drawing.Color.DimHi, i would choose to use the asp.net menu please check the following article http://msdn.microsoft.com/en-us/library/ecs0x9w5(VS.80).aspx[^]
Regards, Jamil
-
Hi, I've made a menu manually by creating linkbuttons, each time i click on a button, i get the rest of the items in this way. the menu was created in a MASTERPAGE! item 1 subitem11 item 2 subitem12 item 3 subitem13 item 4 and if i click on item 2 - what was before disappears and i get the subitems for item 2. and its working great. anyway, when i click on any of the items, i change the color of this item, then i Response.Redirect it to the desired page. when i redirect it to the page it loses all of the proporties i have set to this specific linkbutton. Is there anyway i can save those proporties each time i redirect to another page? here is the C# code i've made:
protected void LinkButton1_Click(object sender, EventArgs e)
{
this.LinkButton1.ForeColor = System.Drawing.Color.Red;
this.LinkButton2.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton3.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton4.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.ForeColor = System.Drawing.Color.DimGray;
this.sub2.ForeColor = System.Drawing.Color.DimGray;
this.sub3.ForeColor = System.Drawing.Color.DimGray;
this.sub4.ForeColor = System.Drawing.Color.DimGray;
this.sub5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.Visible = true;
this.sub1.Text = "BIOGRAPHY";
this.sub2.Visible = true;
this.sub2.Text = "DISTINCTIONS";
this.sub3.Visible = true;
this.sub3.Text = "EXHIBITIONS";
this.sub4.Visible = true;
this.sub4.Text = "LECTURES";
this.sub5.Visible = false;
this.asub1.Visible = false;
this.asub2.Visible = false;
this.asub3.Visible = false;
this.asub4.Visible = false;
this.asub5.Visible = false;
this.asub6.Visible = false;
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
this.LinkButton1.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton2.ForeColor = System.Drawing.Color.Red;
this.LinkButton3.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton4.ForeColor = System.Drawing.Color.DimGray;
this.LinkButton5.ForeColor = System.Drawing.Color.DimGray;
this.sub1.ForeColor = System.Drawing.Color.DimGray;
this.sub2.ForeColor = System.Drawing.Color.DimGray;
this.sub3.ForeColor = System.Drawing.Color.Dim