分配列表以查看状态ASP.net

时间:2016-01-13 09:24:08

标签: asp.net

逗人 我们有.net页面有更新面板

        <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>

当我们尝试按此代码编辑页面时

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

它的工作正常,但是当我将列表分配到查看状态之后页面保持其状态而不是更改为编辑模式

        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;

当我将最后两行添加到我们的代码时,该页面无效并保持在查看模式

  • 当我们将赋值更改为

    之类的字符串时

    ViewState.Add(&#34; AttachmentList&#34;,&#34; Hello&#34;); // AttachmentList;

    页面再次工作并更改为编辑模式

我的问题为什么当我添加对象列表来查看状态时页面不会改变其模式

0 个答案:

没有答案