Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Manual menu of linkbuttons

Manual menu of linkbuttons

Scheduled Pinned Locked Moved ASP.NET
csharpgraphicsjsonquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Farraj
    wrote on last edited by
    #1

    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

    A J F 3 Replies Last reply
    0
    • F Farraj

      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

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      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.

      P 1 Reply Last reply
      0
      • A Abhijit Jana

        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.

        P Offline
        P Offline
        PunkIsNotDead
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • F Farraj

          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

          J Offline
          J Offline
          Jamil Hallal
          wrote on last edited by
          #4

          Hi, 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

          1 Reply Last reply
          0
          • F Farraj

            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

            F Offline
            F Offline
            Farraj
            wrote on last edited by
            #5

            Yeah a menu control could be just great, the only problem i couldnt design it the way i need it to be like this : http://www.campobaeza.com/[^] any ideas?

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups