I have Sql Database and I want to bind it through LINQ from code-behind programmatically in C#.NET. How can I do that?
I have the following code written:
public void populatetree()
{
using (DataClasses1DataContext db = new DataClasses1DataContext())
{
MsgType mt=new MsgType();
RadTreeView1.DataFieldParentID = mt.ParentID.ToString();
RadTreeView1.DataFieldID = mt.ID.ToString();
RadTreeView1.DataValueField = mt.ID.ToString();
RadTreeView1.DataTextField = mt.Name;
RadTreeView1.ToolTip = mt.Description;
RadTreeView1.DataSource= ?
RadTreeView1.DataBind();
}
}
what shud I do for the datasource?
I have the following code written:
public void populatetree()
{
using (DataClasses1DataContext db = new DataClasses1DataContext())
{
MsgType mt=new MsgType();
RadTreeView1.DataFieldParentID = mt.ParentID.ToString();
RadTreeView1.DataFieldID = mt.ID.ToString();
RadTreeView1.DataValueField = mt.ID.ToString();
RadTreeView1.DataTextField = mt.Name;
RadTreeView1.ToolTip = mt.Description;
RadTreeView1.DataSource= ?
RadTreeView1.DataBind();
}
}
what shud I do for the datasource?