How get my old status after refresh

2 posts, 0 answers
  1. Mario
    Mario avatar
    25 posts
    Member since:
    Jan 2012

    Posted 15 Aug 2012 Link to this post

    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
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 16 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top