Click here to Skip to main content
13,408,987 members (47,068 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
<asp:Label ID="lblHeaderMenu" runat="server" Text=""></asp:Label>
               <asp:Label ID="LblChildMenu" runat="server" Text=""></asp:Label>



dynamic.cs
string[] smenu = new string[5];
        string []parentMenu =new string [5];
        StringBuilder sb = new StringBuilder();
        smenu = obj.GetMenu();
        parentMenu = obj.ParentMenuName;
        //   parentMenu = = obj.GetChild();
        string lstr = "";
        string listr = "";
        // string lgtmenu = "";
        lstr = Convert.ToString(("<ul class='nav nav-list'>"));
        listr = Convert.ToString(("<ul class='dropdown-menu submenu'>"));



        for (int i = 0; i <= 5; i++)

        {

            lstr += Convert.ToString(("<li class='active'> <a href='index.html'><i class='icon-dashboard'></i><span>"));
            lstr += (Convert.ToString(smenu[i]));
            lstr += Convert.ToString(("</span></a></li>"));

            for (int ii = 0; ii <= 5 ; ii++)

            {

                listr += Convert.ToString(("<li> <a href='index.html'><i class='icon-double-angle-right'></i><span>"));
                listr += (Convert.ToString(parentMenu[ii]));
                listr += Convert.ToString(("</span></a></li>"));
            }
            listr += Convert.ToString(("</ul>"));
            lblHeaderMenu.Text = lstr;
        }
        lstr += Convert.ToString(("</ul>"));
        LblChildMenu.Text = listr;
    }
}



class.cs
public string [] ParentMenuName = new string[8];
public string[] GetMenu()
{

SqlConnection Conn = new SqlConnection(constr);
Conn.Open();
SqlCommand Cmd = new SqlCommand("prp", Conn);
Cmd.Parameters.AddWithValue("@id", 1);
Cmd.Parameters.AddWithValue("@MasterID", 0);
Cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adp = new SqlDataAdapter(Cmd);
DataTable ds = new DataTable();
adp.Fill(ds);
//Cmd.ExecuteNonQuery();
//SqlDataReader dr2 = Cmd.ExecuteReader();

string[] value = new string[8];
int [] id = new int [8];
int Name = 0;
int ID = 0;
//while (dr2.Read())
foreach (DataRow parent in ds.Rows )
{
value[Name] = Convert.ToString(parent["MasterName"]) ;
id[ID] = Convert.ToInt16(parent["ID"]);
Name = Name + 1;
ID = ID + 1;

}

GetChild(ID);
Cmd.Dispose();
Conn.Close();
Conn.Dispose();
return value;
}
public string [] GetChild(int masterID)
{
SqlConnection Conn = new SqlConnection(constr);
Conn.Open();
SqlCommand Cmd = new SqlCommand("prp", Conn);
Cmd.Parameters.AddWithValue("@id", 2);
Cmd.Parameters.AddWithValue("@MasterID",masterID );
Cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adp = new SqlDataAdapter(Cmd);
DataTable ds = new DataTable();
adp.Fill(ds);

int[] id = new int[8];
int Name = 0;
int ID = 0;
//while (dr2.Read())
foreach (DataRow parent in ds.Rows)
{
ParentMenuName[Name] = Convert.ToString(parent["ParentName"]);
/// id[ID] = Convert.ToInt16(parent["ParentID"]);
Name = Name + 1;

}
//dss.Close();

Cmd.Dispose();
Conn.Close();
Conn.Dispose();
return ParentMenuName;

}



this is my own code but i want to open child menu inside parent menu but he open outside class any buddy help me
Posted 9-Jul-13 2:49am

1 solution

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

Solution 1

  Permalink  
Comments
manoj s sherje 9-Jul-13 8:12am
   
sir but i ma using dynamically using html tag
Nirav Prabtani 9-Jul-13 8:14am
   
what is d error u got???

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.180221.1 | Last Updated 9 Jul 2013
Copyright © CodeProject, 1999-2018
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