Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 504301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:28:57+00:00 2026-05-13T06:28:57+00:00

I have an ASP.NET Page that contains a User control called ReportCtrl (my own

  • 0

I have an ASP.NET Page that contains a User control called ReportCtrl (my own control that has nothing to do with Reporting services etc.). ReportCtrl has a User control called TreeViewCtrl which contains a Telerik TreeView with some funky business logic to display nodes.

The TreeView is placed inside a ASP.NET AJAX panel. When a user clicks on a checkable node, it posts back to the server and saves a new Mapping object (marked Serializable) into a List which is stored in ViewState.

The issue I’ve been bumping against is that:-

  1. When the first checkbox is checked, the item is saved into the List which is then added to ViewState.
  2. When the second checkbox is checked, the item is saved into the List which is then added to ViewState.
  3. When the third checkbox is checked, the loaded ViewState only has 1 item in it.

I have overridden to check the number of items in ViewState and I can see that when the second item is checked, the SaveViewState is saving the ViewState with 3 items. When the LoadViewState is called on the third checkbox, I can see the decoded ViewState only has 1 item in it.

protected override void LoadViewState(object savedState)
protected override object SaveViewState()

Somehow, the Viewstate only works for 1 item and only for the FIRST item.

We have verified that this has nothing to do with the Telerik TreeView by removing it and just adding items manually on button click events. We have also eliminated the object by storing a list of strings.

We’re fresh out of ideas on what to try. Has anyone run into this issue before? Any ideas that we can try?

Thanks.

CODE

Here is the code for the UpdatePanel:

<asp:UpdatePanel runat="server" ID="upnlTreeView" ChildrenAsTriggers="true" 
        RenderMode="Inline" UpdateMode="Conditional" EnableViewState="true">
<ContentTemplate>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ClickedNodeLabel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
        <telerik:RadTreeView ID="RadTreeView1" runat="server" Width="100%" Height="420px"
            PersistLoadOnDemandNodes="true" LoadingStatusPosition="BelowNodeText" CausesValidation="false"
            OnClientNodePopulated="nodePopulated" OnClientNodePopulating="nodePopulating" OnClientLoad="onLoad"
            CheckBoxes="true" CheckChildNodes="false" AllowNodeEditing="false" MultipleSelect="false" 
            LoadingMessage="Loading..." AppendDataBoundItems="true" Skin="Vista" EnableViewState="true" 
            onnodecheck="RadTreeView1_NodeCheck"  >

            <ExpandAnimation Type="none" />
            <CollapseAnimation Type="none" />
            <WebServiceSettings Path="/ESConsole/ws/PTService.asmx" Method="GetNodes" />

        </telerik:RadTreeView>

</ContentTemplate>

Here is the code for the List definition and other methods in the code behind:

    public List<ECodeMapping> ECodeMappings
    {
        get
        {
            return (ViewState["__lstECodeMapping"] == null) ? new List<ECodeMapping>()
                : ViewState["__lstECodeMapping"] as List<ECodeMapping>;
        }
        set { ViewState["__lstECodeMapping"] = value; }
    }
    protected override void LoadViewState(object savedState)
    {
        base.LoadViewState(savedState);
        int count1 = (ViewState["__lstECodeMapping"] as List<ECodeMapping>).Count;
    }

    protected override object SaveViewState()
    {
        int count1 = (ViewState["__lstECodeMapping"] as List<ECodeMapping>).Count;
        return base.SaveViewState();
    }
    protected void RadTreeView1_NodeCheck(object sender, RadTreeNodeEventArgs e)
    {
        RadTreeNode node = e.Node;
        int iLevel = node.Attributes["Level"].ToSafeInt();
        if (iLevel == 2)
        {
            var nList = ECodeMappings.FindAll(x => x.DocId == node.Value.ToSafeInt() && x.SecId < 1);
            if (nList.Count() == 0 && node.Checked == true)
            {
                // Add the node if it doesn't exist
                ECodeMapping newMapping = new ECodeMapping { ReportId = ReportId, DocId = node.Value.ToSafeInt(), SecId = int.MinValue };
                ECodeMappings.Insert(0, newMapping);
                return;
            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:28:58+00:00Added an answer on May 13, 2026 at 6:28 am

    Found the problem.

    We had a script in the parent user control that looked as follows:-

    BAD CODE

    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest(EndRequest);
    var postBackElement;
    function EndRequest(sender, args) {
        if (postBackElement.id == '<%= btnUpload.ClientID %>')
            var uprog1 = $get('<%= this.UpdateProgress1.ClientID %>');
            if(uprog1 != null)
            {
             uprog1.style.display = 'none';
            }
            $find('<%= mpeProgress.ClientID %>').hide();
    }
    

    This offending script had to be changed to the following:-

    GOOD CODE

    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest(EndRequest);
    var postBackElement = null;
    function EndRequest(sender, args) {
        if (postBackElement != null && postBackElement.id == '<%= btnUpload.ClientID %>')
            var uprog1 = $get('<%= this.UpdateProgress1.ClientID %>');
            if(uprog1 != null)
            {
             uprog1.style.display = 'none';
            }
            $find('<%= mpeProgress.ClientID %>').hide();
    }
    

    Summary

    The postBackElement needed to be checked for nulls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 268k
  • Answers 268k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer - is a special character within square brackets. It indicates… May 13, 2026 at 1:07 pm
  • Editorial Team
    Editorial Team added an answer knowledge of how to perform payment transactions using various APIs.… May 13, 2026 at 1:07 pm
  • Editorial Team
    Editorial Team added an answer For snapshot replication you can check indeed if both jobs… May 13, 2026 at 1:07 pm

Related Questions

I am using asp.net 3.5 and want to render the contents of a static
I have an ASP.NET application that uses Session.SessionID to prevent multiple users viewing the
I have an ASP.NET user control that contains a text box control and a
I have an ASP.Net web user control that contains a TextBox and a calendar
The Scenario I have an ASP.Net Web Project that uses a master page. This

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.