This is a migrated thread and some comments may be shown as answers.

Report data binding

1 Answer 44 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Yoni Dagan
Top achievements
Rank 1
Yoni Dagan asked on 29 Jul 2008, 09:14 AM

Requirements

RadControls version

Q1 2008

.NET version

3.5

Visual Studio version

vs2008

programming language

c#

browser support

all browsers supported by RadControls


 
  • I need bind data programmaticaly.
    The code that I started develop the 

    public

    void RefreshReport()

    {

    tb_reportName.Value =

    "Queue of " + this.ReportParameters["QueueTypeParam"].Value.ToString();

    LinqDSDataContext db = new LinqDSDataContext();

    db.Connection.Open();

    if (db != null && db.Connection.State == ConnectionState.Open)

    {

    #region

    Define db query by queue type

    IQueryable<hc_Scoring> Recordings = null;

    switch (this.ReportParameters["QueueTypeParam"].Value.ToString())

    {

    case "Scorer":

    Recordings = (

    from r in db.hc_Scorings.Where(r => r.Status < 250 && r.Status >= 10 && r.Status != 30 && r.Status != 31 && r.Status != 32)

    orderby r.TransferDate

    orderby r.Priority descending

    select r);

    break;

    case "Supervisor":

    Recordings = (

    from r in db.hc_Scorings.Where(r => r.Status == 30)

    orderby r.TransferDate

    orderby r.Priority descending

    select r);

    break;

    case "Tech support":

    Recordings = (

    from r in db.hc_Scorings.Where(r => r.Status == 32)

    orderby r.TransferDate

    orderby r.Priority descending

    select r);

    break;

    case "Doctor":

    Recordings = (

    from r in db.hc_Scorings.Where(r => r.Status == 31)

    orderby r.TransferDate

    orderby r.Priority descending

    select r);

    break;

    }

    #endregion

    #region

    sortting

    bool sortDescending = (bool)this.ReportParameters["DirSort"].Value;

    switch (this.ReportParameters["FieldSort"].Value.ToString())

    {

    case "1":

    if (sortDescending)

    {

    Recordings = Recordings.OrderByDescending(u => u.ScoringId)

    .ThenBy(u => u.TransferDate).ThenBy(u => u.Priority);

    }

    else

    {

    Recordings = Recordings.OrderBy(u => u.ScoringId)

    .ThenBy(u => u.TransferDate).ThenBy(u => u.Priority);

    }

    break;

    case "2":

    if (sortDescending)

    {

    Recordings = Recordings.OrderByDescending(u => u.TransferDate)

    .ThenBy(u => u.Priority);

    }

    else

    {

    Recordings = Recordings.OrderBy(u => u.TransferDate)

    .ThenBy(u => u.Priority);

    }

    break;

    case "3":

    if (sortDescending)

    {

    Recordings = Recordings.OrderByDescending(u => u.Priority)

    .ThenBy(u => u.TransferDate);

    }

    else

    {

    Recordings = Recordings.OrderBy(u => u.Priority)

    .ThenBy(u => u.TransferDate);

    }

    break;

    case "5":

    if (sortDescending)

    {

    Recordings = Recordings.OrderByDescending(u => u.Status)

    .ThenBy(u => u.Priority).ThenBy(u => u.TransferDate);

    }

    else

    {

    Recordings = Recordings.OrderBy(u => u.Status)

    .ThenBy(u => u.Priority).ThenBy(u => u.TransferDate);

    }

    break;

    }

    #endregion

    this.DataSource = Recordings;

    tb_hcid.Value = ??????????????????

    }

    }

    How I need continue?
    Thanks ahead
    Sergey R.
  • 1 Answer, 1 is accepted

    Sort by
    0
    Atanas Korchev
    Telerik team
    answered on 29 Jul 2008, 11:40 AM
    Hi Sergey,

    RadTreeView cannot bind hierarchically to IQueriable<hc_sorting>. You need to programatically traverse your data and create RadTreeNode objects on the fly.

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
    Tags
    TreeView
    Asked by
    Yoni Dagan
    Top achievements
    Rank 1
    Answers by
    Atanas Korchev
    Telerik team
    Share this question
    or