I have Treeview,Binding with Entities.Have class with Entities.Inside the Entity I have Properties and also IList.I want to bing Property1 as ParentNode and Corresponding IList
Class A:IEntity
{
Public Property1{Get;Set;}
Public Property2{Get;Set;}
Public IList
}
Subhendu DePosted Dec 9, 2010, 8:22 AM
I tried it through asp.net treeview control. Please refer the code below
public partial class WebForm3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
IList
_states[0] = new List
_states[0].Add("West Bengal");
_states[0].Add("Maharashtra");
_states[0].Add("Kerala");
_states[0].Add("Karnataka");
_states[1] = new List
_states[1].Add("IN");
_states[1].Add("CA");
_states[1].Add("PA");
_states[1].Add("TN");
TreeClass[] _treeclasses = new TreeClass[2];
_treeclasses[0] = new TreeClass();
_treeclasses[0].ParentNode = "India";
_treeclasses[0].ChildNodes = _states[0];
_treeclasses[1] = new TreeClass();
_treeclasses[1].ParentNode = "US";
_treeclasses[1].ChildNodes = _states[1];
foreach (TreeClass _tc in _treeclasses)
{
TreeNode _parentnode = new TreeNode();
_parentnode.Text = _tc.ParentNode;
foreach (string strChild in _tc.ChildNodes)
{
TreeNode _childnode = new TreeNode();
_childnode.Text = strChild;
_parentnode.ChildNodes.Add(_childnode);
}
TreeView1.Nodes.Add(_parentnode);
}
}
}
class TreeClass
{
public string ParentNode { get; set; }
public IList
}
CrishPosted Dec 10, 2010, 5:47 AM
To get more detail about Binding Treeview with IEntity and Ilist.you have to just refer this following link.
http://forums.silverlight.net/forums/p/115456/260268.aspx
lakshmi prasannaPosted Dec 10, 2010, 2:21 AM
When i am selecting first node,selecting but when i select the second one previous one remains same and current one is not selecting.I don't need post back and in Button click i need to get the selectedNode that's it.
I have gone throught the articles but Huge Javascript code is there and I also found Simple Code like.will it works?Using VisualStudio2010.
Javascript:Treeview_selectedNode(,
Like this Can i have propercode and also in which event i can call this Javascript function?
lakshmi prasannaPosted Dec 10, 2010, 12:28 AM