- Home
- Forum
- ASP.NET Web Forms (Classic)
- Treeview Template Itemdatabound?
Treeview Template Itemdatabound?
I am working on a treeview with a template that has a dropdownlist in it. Since I cannot databind on the Listitem in order to set the selected item, I am wondering how I can do this? In gridview, I would use the RowDataBound event. Is there anything similar to this for the treeview?
Here is my Treeview Template:
Here is my Treeview Template:
SIGN IN To post a reply.
2 Replies
KG
Kathy Gray
November 6, 2007 10:06 PM UTC
I am also wondering if there is a way to access this dropdownlist in the server code, if I have the treeviewnode associated with it. In other words, how do I ask the code for the dropdownlist that is in the template for a specific node?
>I am working on a treeview with a template that has a dropdownlist in it. Since I cannot databind on the Listitem in order to set the selected item, I am wondering how I can do this? In gridview, I would use the RowDataBound event. Is there anything similar to this for the treeview?
Here is my Treeview Template:
>I am working on a treeview with a template that has a dropdownlist in it. Since I cannot databind on the Listitem in order to set the selected item, I am wondering how I can do this? In gridview, I would use the RowDataBound event. Is there anything similar to this for the treeview?
Here is my Treeview Template:
MW
Melba Winshia
Syncfusion Team
November 10, 2007 12:07 PM UTC
Hi Kathy,
Thank you for your interest in Syncfusion Products.
1) Since I cannot databind on the Listitem in order to set the selected item, I am wondering how I can do this?
If your intention is to set the selected item with dynamic data binding on the asp.net page, then it can be achieved by following the techniques discussed in the below forum:
http://forums.asp.net/p/1156810/1901549.aspx
If I have misunderstood your requirement, could you please explain me in detail, so that I can work in depth and try to send a better solution?
2) if there is a way to access this dropdownlist in the server code
Yes. You can access the dropdownlist in the server code. But for this you must add the control in the TemplateControl collection on the server side.
[C#]
Please refer the sample in the below link which illustrates the above:
http://www.syncfusion.com/Support/user/uploads/TreeViewWithTemplat_28ea0b58.zip
Please try this and let me know if this helps.
Thanks,
Melba
Thank you for your interest in Syncfusion Products.
1) Since I cannot databind on the Listitem in order to set the selected item, I am wondering how I can do this?
If your intention is to set the selected item with dynamic data binding on the asp.net page, then it can be achieved by following the techniques discussed in the below forum:
http://forums.asp.net/p/1156810/1901549.aspx
If I have misunderstood your requirement, could you please explain me in detail, so that I can work in depth and try to send a better solution?
2) if there is a way to access this dropdownlist in the server code
Yes. You can access the dropdownlist in the server code. But for this you must add the control in the TemplateControl collection on the server side.
[C#]
//Create new instance of TreeView Template Control
TreeViewTemplateControl CalendarControl = new TreeViewTemplateControl();
CalendarControl.ID = "calendarControl"
//Add Calendar control in the TemplateControl collection
CalendarControl.Controls.Add(Calendar1);
//Add TemplateControl in the Templates collection
TreeView1.Templates.Add(CalendarControl);
//Assign Template ID to TreeView Node
Calendar.TemplateID = "calendarControl";
//Access the dropdownlist
this.Calendar1.BackColor = System.Drawing.Color.Lavender;
Please refer the sample in the below link which illustrates the above:
http://www.syncfusion.com/Support/user/uploads/TreeViewWithTemplat_28ea0b58.zip
Please try this and let me know if this helps.
Thanks,
Melba
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
KG Kathy Gray
- Nov 6, 2007 05:13 PM UTC
- Nov 10, 2007 12:07 PM UTC