I have a menu control in my website where menu items(parent) and sub menu items(child) are populate through database.
In below code ParentId=0 when its a menu item and ParentId > 0 when it's a sub menu item. The code is working fine.
if(!IsPostBack)
{
SqlConnection sqlConnection;
string dbConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
sqlConnection = new SqlConnection(dbConnectionString);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
using (sqlConnection)
{
SqlCommand command = new SqlCommand("proc_GetCategories", sqlConnection);
command.CommandType = CommandType.StoredProcedure;
sqlConnection.Open();
SqlDataAdap ...
Go to the complete details ...