dynamically created node link

Posted by Ashok_29 under ASP.NET on 12/22/2011 | Points: 10 | Views : 1118 | Status : [Member] | Replies : 0
hi guys
i created dynamically tree view for shopping cart when i click on node than i want display Releted product of that node can any on help me asap my code is like below

DataTable dt = new DataTable();
DataSet ds = new DataSet();
SqlDataAdapter daadd = new SqlDataAdapter("select cat_name from product_cat where cat_level=0", con.cn);
daadd.Fill(dt);
ds.Tables.Add(dt);



foreach (DataRow parentnode in ds.Tables[0].Rows)
{
TreeNode r_node = new TreeNode(parentnode["cat_name"].ToString());
Treeview1.Nodes.Add(r_node);
String p_node = parentnode["cat_name"].ToString();
//r_node.NavigateUrl("User Login.aspx");



string str="select * from product_cat where( cat_level=1 and cat_parent='"+p_node+"')";

SqlDataAdapter da1 = new SqlDataAdapter(str, con.cn);
DataTable dt1 = new DataTable();
DataSet ds1 = new DataSet();
da1.Fill(dt1);
ds1.Tables.Add(dt1);

if (ds1.Tables[0].Rows.Count > 0)
{

foreach (DataRow childnode in ds1.Tables[0].Rows)
{
TreeNode c_node = new TreeNode(childnode["cat_name"].ToString());
r_node.ChildNodes.Add(c_node);

just i need the value when i clik on c_node or r_node
thanks for future help




Responses

(No response found.)

Login to post response