Click here to Skip to main content
11,705,453 members (47,671 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET CSS jQuery menu database , +
Hi!
I am sorry for my poor english!
i have this imageDB
database and i want generate this format
<li>main</li>
<ul>
<li>sub</li>
<li>sub</li>
</ul>

by c# and asp.net from this table please help me it's urgent.
Thanks.
Posted 14-Jul-12 10:22am
Edited 14-Jul-12 10:27am
v2
Comments
Abdul Quader Mamun at 14-Jul-12 22:05pm
   
you need to little bit work with the code.

1 solution

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

Solution 1

System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("connectionStringHere");
con.Open(); 
 
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
 
//you need to customize sp as you want
cmd.CommandText = "sp_Here";
 
System.Data.SqlClient.SqlDataReader reader;
reader = cmd.ExecuteReader();
 
System.Text.StringBuilder sb=new System.Text.StringBuilder() 
 
sb.AppenedLine("<ul>");
while(reader.Read())
{
//you need to customize this as you want
sb.AppenedFormat("<li>{0}</li>"  reader.GetString(0));
}
sb.AppenedLine("</ul>");

Try with this code.

Thanks,
Mamun
  Permalink  
Comments
Behnam Mohammadi at 15-Jul-12 14:54pm
   
Thank you very much.
But I want the menu to be made. The following sub-menu to the menu each time to be unlimited.
Such as content management systems.
If someone put the video in my top tips to help me get much thanks.
Very essential and urgent need
Thank you very much.
Abdul Quader Mamun at 15-Jul-12 15:18pm
   
http://www.codeproject.com/Articles/124969/Parent-Child-Hierarchical-Relational-Treeview-User

here is an example of parent-child or upto infinity. try with this
Behnam Mohammadi at 24-Jul-12 11:46am
   
Thanks.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 286
1 OriginalGriff 269
2 ppolymorphe 78
3 Inimicos 60
4 ProgramFOX 50
0 OriginalGriff 9,053
1 Sergey Alexandrovich Kryukov 8,347
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,626


Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 15 Jul 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