This is a migrated thread and some comments may be shown as answers.

Remember resize of grid columns

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
drpcken
Top achievements
Rank 1
drpcken asked on 04 Feb 2009, 10:06 PM
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!

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Feb 2009, 08:19 AM
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.
Tags
Grid
Asked by
drpcken
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or