Remember resize of grid columns

2 posts, 0 answers
  1. drpcken
    drpcken avatar
    36 posts
    Member since:
    Feb 2007

    Posted 04 Feb 2009 Link to this post

    I know how to set the grid to resize the columns, easy part.  But I need it to remember the column sizing per user.  Would I have to store these values in a database table?

    Has anyone had to do this before?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Feb 2009 Link to this post


    One suggestion will be to get the width of the column while resizing and store the value in hidden element. You can access the value of the hidden input on the server side and store it to the DataBase.

         <input id="Hidden1" type="hidden"    runat="server" /> 

       <ClientSettings   AllowColumnsReorder="true" > 
                       <Resizing  AllowColumnResize="true"  /> 
                       <ClientEvents OnColumnResizing="ColumnResizing"  /> 

    <script type="text/javascript" > 
      function ColumnResizing(sender, eventArgs) 
      var input=document.getElementById('<%=Hidden1.ClientID %>'); 
      var colWidth=eventArgs.get_gridColumn().get_element().offsetWidth; 

     // to access the width of the column from hidden input
    string strval = Hidden1.Value; 
       // store the value in database 

Back to Top