locked
Assign List to view state ASP.net RRS feed

  • Question

  • User-1131305252 posted

    Dears
    we have .net page has Update panel

    <div class="lists collaps_container ">
    
    <asp:UpdatePanel runat="server" ID="upMain" UpdateMode="Always">
    <ContentTemplate>
    <table style="width: 100%">
    <tr>
    <td>
    <common:Message runat="server" ID="ucMessage" />
    </td>
    </tr>
    </table>
    <common:JalsaStatmentView runat="server" id="JalsaStatmentView" />
    </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress runat="server" AssociatedUpdatePanelID="upMain" ID="uppMain" DisplayAfter="1">
    <ProgressTemplate>
    <div class="divWaiting">
    <img src="/Design/images/loading.gif" height="120" width="120" />
    </div>
    </ProgressTemplate>
    </asp:UpdateProgress>
    </div>



    when we try to edit the page by this code

    txtIdea.ReadOnly = ISActive;
    txtIdea.CssClass = CSSClass;
    txtStatement.ReadOnly = ISActive;
    txtStatement.CssClass = CSSClass;
    txtSubject.ReadOnly = ISActive;
    txtSubject.CssClass = CSSClass;
    chkIsResolved.Enabled = !ISActive;

    it's work normal, but when i assign the list to view state after that the page keep its state and not change to edit mode

    txtIdea.ReadOnly = ISActive;
    txtIdea.CssClass = CSSClass;
    txtStatement.ReadOnly = ISActive;
    txtStatement.CssClass = CSSClass;
    txtSubject.ReadOnly = ISActive;
    txtSubject.CssClass = CSSClass;
    chkIsResolved.Enabled = !ISActive;
    
    List<RequestAttachment> AttachmentList = new List<RequestAttachment>();//dbContext.RequestAttachment.GetByQuery(x => x.EntryTypeId == 2 && x.EntryId == statementID && x.UpdatedBy != HttpContext.Current.User.Identity.Name).ToList();
    ViewState.Add("AttachmentList", AttachmentList);//AttachmentList;

    when i add the last tow rows to our code the page not work and stay in view mode

    * when we change the assign to string like that

    ViewState.Add("AttachmentList", "Hello");//AttachmentList;

    the page work again and changed to the edit mode ,

    My problem why when i add List of object to view state the page not change its mode

    Wednesday, January 13, 2016 9:53 AM

Answers