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

How get my old status after refresh

1 Answer 21 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mario
Top achievements
Rank 1
Mario asked on 15 Aug 2012, 12:22 PM
Hello,
I use a TreeView with Checkboxes. I refresh my TreeView every 30 seconds with a timer. This works very well. Unfortunately, when i have selected any Items after the refresh my Selecting is lost. Is it possible, that i get my old Selection after the Refresh?

I use a ObjectDataSource (ODSLoadPlayerFromScheduler) for my TreeView.
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        LoadDB();
    }
    else if (IsPostBack)
    {
        LoadDBAfterPostback(); 
    }
}
 
 
 
private void LoadDB()
{
    int projectGroupID = pgID;
 
    if (!parameter.ToLower().Contains("administrators"))
    {
        ODSLoadPlayerFromScheduler.SelectParameters.Add("GroupName", parameter);
        ODSLoadPlayerFromScheduler.SelectParameters.Add("projectGroupID", projectGroupID.ToString());
    }
    else
    {
        ODSLoadPlayerFromScheduler.SelectParameters.Add("projectGroupID", projectGroupID.ToString());
    }       
}
 
private void LoadDBAfterPostback()
{
    int projectGroupID = pgID;
 
    if (!parameter.ToLower().Contains("administrators"))
    {
        ODSLoadPlayerFromScheduler.SelectParameters["GroupName"].DefaultValue = parameter;
        ODSLoadPlayerFromScheduler.SelectParameters["projectGroupID"].DefaultValue = projectGroupID.ToString();
    }
    else
    {
        ODSLoadPlayerFromScheduler.SelectParameters["projectGroupID"].DefaultValue = projectGroupID.ToString();
    }
}
 
protected void Timer1_Tick(object sender, EventArgs e)
    {
        LoadDBAfterPostback();
    }

Can you help me with the solution to my problem?

BR
Reiner

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 16 Aug 2012, 08:16 AM
Hello Mario,

One approach you could use is to simply store each selected value in a HiddenField. Then after each refresh, you could get the stored values from the hidden field and bind them to your RadTreeView.

All the best,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TreeView
Asked by
Mario
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or