Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 545
1 Dnyaneshwar@Pune 500
2 ravikhoda 325
3 OriginalGriff 277
4 Damith Weerasinghe 265
0 Sergey Alexandrovich Kryukov 10,974
1 OriginalGriff 6,777
2 Peter Leow 4,785
3 Abhinav S 3,813
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web03 | 2.8.140421.2 | Last Updated 15 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid