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?

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

    Posted 05 Feb 2009 Link to this post

    Hi,

    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.

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

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


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


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


    Thanks
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top