﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Any way to get webgrid's column resized width to save</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Any-way-to-get-webgrids-column-resized-width-to-save/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Any way to get webgrid's column resized width to save</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Any-way-to-get-webgrids-column-resized-width-to-save/</link><pubDate>Thu, 24 Nov 2016 08:39:44 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;&lt;span&gt;... return resized webgrid columns so it could be save and used to fix the width when user return to that page next time...&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;WebGrid has SaveTablesStructureToXml() method which allows you to save RootTable properties – including its Columns and ChildTables – along with all objects contained to an XML file. The table structure can be applied to WebGrid by using LoadTablesStructureFromXml method. The method will loads table file structure from an XML file and restore it to RootTable of WebGrid.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;The snippet code below shows how to save and restore WebGrid's table structure to/from XML file.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;protected void Button1_Click(object sender, EventArgs e)
{
	WebGrid1.SaveTablesStructureToXml(Server.MapPath("WebGridTableStructure.xml"));
}&lt;/pre&gt;&lt;br&gt;
&lt;pre&gt;protected void Button1_Click(object sender, EventArgs e)
{
	WebGrid1.LoadTablesStructureFromXml(Server.MapPath("WebGridTableStructure.xml"));
}&lt;/pre&gt;&lt;br&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Alternatively, you can save the structure to memorystream by invoking SaveTablesStructure() method.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;protected void Button1_Click(object sender, EventArgs e)
{
    MemoryStream ms = new MemoryStream();
    WebGrid1.SaveTablesStructure(ms);

    Session["wgState"] = ms;
}&lt;/pre&gt;&lt;br&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Then load it by invoking LoadTablesStructure() method.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;protected void Button2_Click(object sender, EventArgs e)
{
    // retrieve the saved state
		object state = Session["wgState"];
        if (state != null)
        {
            MemoryStream ms = (MemoryStream)state;
            ms.Seek(0, SeekOrigin.Begin);
            WebGrid1.LoadTablesStructure(ms);
            WebGrid1.RebindDataSource();
        }
}&lt;/pre&gt;&lt;br&gt;

&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Any way to get webgrid's column resized width to save</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Any-way-to-get-webgrids-column-resized-width-to-save/</link><pubDate>Fri, 18 Nov 2016 08:06:51 GMT</pubDate><dc:creator>sjain</dc:creator><description>Hi,&lt;br&gt; I used OnColumnResize client event to get width of all columns as&lt;br&gt;&lt;br&gt;&amp;lt;ClientSideEvents OnColumnResize="TestresizeColumn" /&amp;gt;&lt;br&gt;&lt;br&gt;function TestresizeColumn(controlId, tblName, rowIndex, cellIndex, cellEl) {&lt;br&gt; var WebGrid1 = ISGetObject(controlId);&lt;br&gt; var ColumnHeaderElement = WebGrid1.GetRootTable().GetElement(WG40.COLHEADER, WG40.HTMLTABLE);&lt;br&gt; var SelectedCell = ColumnHeaderElement.rows[0].cells;&lt;br&gt; for( i=1; i&amp;lt;SelectedCell.length; i++ )&lt;br&gt; {&lt;br&gt; alert(SelectedCell[i].colName + ' ' + SelectedCell[i].clientWidth);&lt;br&gt; &lt;br&gt; }&lt;br&gt; &lt;br&gt; return true;&lt;br&gt; }&lt;br&gt;&lt;br&gt;but it gave use clientwidth before column reszied.&lt;br&gt;As per documentation &lt;br&gt;&lt;span&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;br&gt;Specifies the client-side function to be invoked when a column is being resized.&lt;br&gt;&lt;br&gt;&lt;br&gt;Would you mind to suggest some other event or way which can be use for get modified column's width after column is resized?&amp;nbsp;&amp;nbsp; Client requires to have same column width which he/she resized in last visit.&lt;br&gt;regards&lt;br&gt;Sachin&lt;br&gt;&lt;br&gt;&lt;br&gt;</description></item><item><title>Any way to get webgrid's column resized width to save</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Any-way-to-get-webgrids-column-resized-width-to-save/</link><pubDate>Fri, 11 Nov 2016 13:00:53 GMT</pubDate><dc:creator>sjain</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; As we can get access of webgrid applied filter on server and client side, is any specific function(server/client) available which can return resized webgrid columns so it could be save and used to fix the width when user return to that page next time ?&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;regards&lt;/p&gt;&lt;p&gt;Sachin&lt;br&gt;&lt;/p&gt;</description></item></channel></rss>