int m = 20; SqlConnection objConnection = new SqlConnection(@"Data Source=STANZOO-FE82BEA\SQLEXPRESS;Initial Catalog=stanzoo;Integrated Security=True"); SqlDataAdapter objdata = new SqlDataAdapter("select distinct categoryid,category from items where category like '" + hdntxtcategories.Value.ToString() + "%'", objConnection); SqlDataAdapter objdata1 = new SqlDataAdapter("select Top 10 subcategoryid,subcategory from items where subcategory like '" + hdntxtcategories.Value.ToString() + "%'", objConnection); DataSet objdataset = new DataSet(); DataSet objdataset1 = new DataSet(); objdata.Fill(objdataset, "Categories"); objdata1.Fill(objdataset1, "SubCategories"); string constructTable = "<table border='1' cellpadding='5' cellspacing='5' height='150px'>"; constructTable += "<tr><td style='vertical-align:top'>"; constructTable += "<div id='s' style='background-color:red;width:150px;align:center'>Categories</div>"; for (int i = 0; i < objdataset.Tables[0].Rows.Count; i++) { // int s=0; //s++; HiddenField1.Value = objdataset.Tables[0].Rows.Count.ToString(); constructTable += "<a style='cursor:pointer'; onclick='javascript:ShowCategory(" + objdataset.Tables[0].Rows[i]["categoryid"].ToString() + ")'><div id='" + i + "'>" + objdataset.Tables[0].Rows[i]["category"] + "</div></a>"; } constructTable += "</td><td style='vertical-align:top'>"; constructTable += "<div style='background-color:red;width:150px;align:center'>Sub Categories</div>"; for (int i = 0; i < objdataset1.Tables[0].Rows.Count; i++) { HiddenField2.Value = objdataset1.Tables[0].Rows.Count.ToString(); constructTable += "<div id=" + m + " style='cursor:hand' onclick='javascript:ShowSubcategory(" + objdataset1.Tables[0].Rows[i]["subcategoryid"].ToString() + ")'>" + objdataset1.Tables[0].Rows[i]["subcategory"] + "</div>"; m++; } constructTable += "</td></tr></table>"; divTable.InnerHtml = constructTable;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)