Click here to Skip to main content
11,635,656 members (78,521 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VS2010 menu
Hello everyone. I just cant seem to figure out how to add an event click for a dynamic menu. I'm very noob in using C# so i'm really dumb about this. Here's my adding of menu code:

private void loadCat()
   {
        mnuCategory.Items.Clear();
           int i = 0;
           foreach (DataRow dr in blcategory.LoadCategory().Rows)
           {
               dt = new DataTable();
               cat = Convert.ToString(dr[1]);
 
               MenuItem mniTemp = new MenuItem();
               mniTemp.Text = cat;
 
               mnuCategory.Items.Add(mniTemp);
 
               if (dt != null)
               {
                   //DataTable dt2;
                   Boolean b;
 
                   b = blcategory.LoadByCatRetNull(cat);
 
                   if (b != true )
                   {
                       foreach (DataRow drc in blcategory.LoadByCat(cat).Rows)
                       {
                       mnuCategory.Items[i].ChildItems.Add(new MenuItem
                       {
                           Text = Convert.ToString(drc[1]),
                           NavigateUrl = "~/ItemsByCat.aspx"
                       });
                     
                      
                   }
                   }
 

               }
               else
               {
 
               }
               i += 1;
           }
   }
 
Please I'm very dumb about this and if you guys can teach me a step by step method to do this is greatly appreciated. Just imagine teaching a dumb person. Thank you so much guys!
Posted 18-Oct-12 21:57pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,861
1 Sergey Alexandrovich Kryukov 8,459
2 Mika Wendelius 6,849
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,270


Advertise | Privacy | Mobile
Web03 | 2.8.150728.1 | Last Updated 19 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100