0

I hope I can explain this properly.

I have a page in ASP.net (3.5) containing a GridView. I have implemented jquery to freeze columns and headers of the GridView (the jquery I implemented can be found here: http://gridviewscroll.aspcity.idv.tw/).

Now, the frustrating part. Any control I place on the page, above the GridView maintains view state on post back. Any control following the GridView loses view state on post back.

<asp:TextBox ID="tbx_Value1" runat="server" />
<asp:TextBox ID="tbx_Value2" runat="server" />
<asp:GridView ID="gv_Data" runat="server" />
<asp:TextBox ID="tbx_Value3" runat="server" />

So, on post back the view state of tbx_Value1, tbx_Value2 and the GridView are retained, but the view state of tbx_ValueValue3 is lost. Setting EnableViewState="true" does not improve the situation.

The JQuery download is called in the following javascript:

<script type="text/javascript">
    var c = 0;
    c = '<%=this.col %>';

    $(document).ready(function() {

        gridviewScroll(c);
    });

    function gridviewScroll(c) {

        $('#<%=gv_Data.ClientID%>').gridviewScroll({
            width: 1350,
            height: 330,
            freezesize: c,
            arrowsize: 30,
            varrowtopimg: "../../../images/arrowvt.png",
            varrowbottomimg: "../../../images/arrowvb.png",
            harrowleftimg: "../../../images/arrowhl.png",
            harrowrightimg: "../../../images/arrowhr.png",
            headerrowcount: 1
        });
    } 
</script>

I am at a loss as to how to address this. I have moved my controls around, recreated the page, rebuilt the application. All of this returns the same result. So, I can only assume it has something to do with the javascript (or jquery download I am using). Perhaps when it is applied in the page life cycle? Javascript/jquery is not my strong point, so any help would be greatly appreciated.

Thank you.

1 Answers1

0

I found the culprit to this query. The Gridview in this situation is dynamically created based on user input. I did not fathom anyone would request or need a very large GridView. However, when they did, the nature of this Gridview being what it is, resulted in a lot of controls being created.

Once I realized this was happening I updated the web.config appSettings key: "aspnet:MaxHttpCollectionKeys" to a larger number, but also restricted the size a user can request.

I arrived at this solution by way of this post: 'Operation is not valid due to the current state of the object' error during postback

Community
  • 1
  • 1