Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > TreeView > Treeview databind to LINQ

Not answered Treeview databind to LINQ

Feed from this thread
  • Naupad avatar

    Posted on Jan 30, 2012 (permalink)

    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?

    Reply

  • jumpstart Master avatar

    Posted on Jan 31, 2012 (permalink)

    Naupad:

    Take a look at the Treeview Datasource for Linq to Entities versus a SQL Command in Code-Behind versus Code-In-Front blog post. The third example, although in VB.NET may be some help here as it populates a RadTreeView. Also, reference the Using Three Flavors of LINQ To Populate a TreeView post, as it provides insights into using LINQ with an ASP.NET Treeview.

    I'm working on a simple demo and will post it when done.

    Regards,

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > TreeView > Treeview databind to LINQ
Related resources for "Treeview databind to LINQ"

ASP.NET TreeView Features  |   Documentation   |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]