﻿<?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 - Column Resizing After Post Back</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ColumnResizeIssue/</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>Column Resizing After Post Back</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ColumnResizeIssue/</link><pubDate>Thu, 21 Jun 2012 23:50:03 GMT</pubDate><dc:creator>Hans</dc:creator><description>&lt;div&gt;Hello,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;Thank you for information code that you have given to me.&lt;/div&gt;
&lt;div&gt;I made a simple project based on your code. I add WebButton to do PostBack event.&lt;/div&gt;
&lt;div&gt;And I can replicate your issue on my end as well (after PostBack event).&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;To resolve this issue, you  should add Name property in your first column (CheckBox Column)&lt;/div&gt;
&lt;div&gt;I enclosed the snippet code that you should modify:&lt;span style="font-size: 10pt; "&gt;...&lt;/span&gt;&lt;/div&gt;&lt;pre&gt;&amp;lt;Columns&amp;gt;
	&amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" Width="35px" AllowSizing="No"/&amp;gt;
	&amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="35px" Name="Tran" AllowSizing="No" /&amp;gt;
	&amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="50px" Name="Num" AllowSizing="No" /&amp;gt;
	...
&amp;lt;/Columns&amp;gt;
...
Modify to:
...
&amp;lt;Columns&amp;gt;
	&amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" Width="35px" AllowSizing="No" Name="CheckBoxColumn" /&amp;gt;
	&amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="35px" Name="Tran" AllowSizing="No" /&amp;gt;
	&amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="50px" Name="Num" AllowSizing="No" /&amp;gt;
	...
&amp;lt;/Columns&amp;gt;
...&lt;/pre&gt;
&lt;p&gt; I also attached my sample. &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps. Thank you.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Hans.&lt;/p&gt;</description></item><item><title>Column Resizing After Post Back</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ColumnResizeIssue/</link><pubDate>Thu, 21 Jun 2012 12:54:32 GMT</pubDate><dc:creator>adajani@najiasystems.com</dc:creator><description>&lt;p&gt;Thanks Hans, but this doesn't solve the problem.&lt;/p&gt;&lt;p&gt;I downloaded the latest hotfixes and updates but that hasn't worked either. &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;To recreate:&lt;/p&gt;
&lt;p&gt;1. Create a grid with the same columsn I've created above. &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;2. On initial page load, you can create a List(of String()) of some values i.e. &lt;br /&gt;&lt;/p&gt;&lt;pre&gt;dim rowData1 as String() = {"", "1", "1", "(", "1", ",", "1", ",", "1", ")", "1", "", "")
dim rowData2 as String() = {"", "2", "2", "(", "2", ",", "2", ",", "2", ")", "2", "", "")
dim myList as new List(of String())
myList.add(rowData1);
myList.add(rowData2);&lt;br /&gt;&lt;br /&gt;dim newRow as New WebGridRow(myList);&lt;br /&gt;myGrid.RootTable.Rows().add(newRow);&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Add as many of these as you want. Save this list in the session somewhere too.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;3. Add a button on the screen that will create a post back. For that buttons handler, retreive the data from session, iterate through the list and add the rows again i.e.&lt;/p&gt;&lt;pre&gt;''' &amp;lt;summary&amp;gt;
    ''' binds this list to the grid
    ''' &amp;lt;/summary&amp;gt;
    ''' &amp;lt;param name="results"&amp;gt;&amp;lt;/param&amp;gt;
    ''' &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;
    Private Sub BindGrid(ByVal results As List(Of String()))
        ' Note (XXX): we can't bind the grid by simply setting the datasource property since this is a list of string arrays
        ' we have to iterate through the list and add each row manually
        If results IsNot Nothing Then
            For i As Integer = 0 To results.Count - 1
                Dim data As String() = results(i)
                Me.wbCompareResults.RootTable.Rows().Add(New ISNet.WebUI.WebGrid.WebGridRow(data))
            Next
        End If
    End Sub&lt;/pre&gt;
&lt;p&gt;Below is the RowInitialize handler for the grid. I am inserting a checkbox for the first column:&lt;/p&gt;&lt;pre&gt;Private Sub wbCompareResults_InitializeRow(sender As Object, e As ISNet.WebUI.WebGrid.RowEventArgs) Handles wbCompareResults.InitializeRow
        If e.Row.Type = ISNet.WebUI.WebGrid.RowType.Record Then
                ' add the checbox control &lt;br /&gt;                ' I had some other code here for the checkbox, but this should be sufficient.&lt;br /&gt;                e.Row.Cells(0).Text = "&amp;lt;input type=""checkbox""/&amp;gt;"
        End If
    End Sub&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;I also added the client side OnInitialize function you provided.&lt;/p&gt;
&lt;p&gt;Looking forward to your response.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Column Resizing After Post Back</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ColumnResizeIssue/</link><pubDate>Thu, 21 Jun 2012 00:06:33 GMT</pubDate><dc:creator>Hans</dc:creator><description>&lt;div&gt;Hello,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;I’m sorry for the inconvenience.&lt;/div&gt;
&lt;div&gt;This issue occurs, perhaps because of WebGrid doesn’t do resize completely after do post back.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;To handle this issue, you could use wgDoResize() javascript function in OnInitialize() client side event of WebGrid.&lt;/div&gt;
&lt;div&gt;Here’s the snippet example code, how to use wgDoResize() function:&lt;/div&gt;
&lt;div&gt;&lt;pre&gt;function WebGrid1_OnInitialize(controlId)
{
	var WebGrid1 = ISGetObject(controlId);
	wgDoResize(true, true);
	return true;
}&lt;/pre&gt;&lt;p /&gt;&lt;p&gt;Then please ensure that you are using our latest hotfix version for WebGrid and the framework.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If the issue still occur, could you tell me the step by step how to reproduce this issue?&lt;/p&gt;&lt;p&gt;Or if you don’t mind, could you please send me a simple project that replicate this issue?&lt;/p&gt;&lt;p&gt;So that I can investigate this issue further.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Hope this helps. Thank you.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Regards,&lt;/p&gt;&lt;p&gt;Hans.&lt;/p&gt;&lt;p /&gt;&lt;/div&gt;</description></item><item><title>Column Resizing After Post Back</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ColumnResizeIssue/</link><pubDate>Wed, 20 Jun 2012 14:07:05 GMT</pubDate><dc:creator>adajani@najiasystems.com</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I'm having a problem with my webgrid columns resizing after postback. I've attached a before an after image to illustrate the problem. During the loading of the page, I add the rows in the code behind. I then post back to the server for processing, and rebind the grid. Code is below:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;ISWebGrid:WebGrid ID="wbCompareResults" runat="server" Height="75%" Width="100%" UseDefaultStyle="true" EnableWebResources="Always"
                            CustomSchemaRetrieval="UseWebGrid"&amp;gt;
            &amp;lt;RootTable GridLineStyle="NotSet"&amp;gt;
                &amp;lt;Columns&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" Width="35px" AllowSizing="No" /&amp;gt; 
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="35px" Name="Tran" AllowSizing="No" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="50px" Name="Num" AllowSizing="No" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="10px" AllowSizing="No" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="50px" Name="LT" AllowSizing="No" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="10px" AllowSizing="No" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="50px" Name="BT" AllowSizing="No" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="10px" AllowSizing="No" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="50px" Name="BC" AllowSizing="No" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Text" Width="10px" AllowSizing="No" /&amp;gt;
                    &amp;lt;%--&amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" IsAutoWidth="true" AllowSizing="Yes" Name="Description" Caption="Description" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" IsAutoWidth="true" AllowSizing="Yes" Name="Field" Caption="Field" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" IsAutoWidth="true" AllowSizing="Yes" Name="Value" Caption="Value" /&amp;gt;--%&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" Width="725px" AllowSizing="Yes" Name="Description" Caption="Description" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" Width="110px" AllowSizing="Yes" Name="Field" Caption="Field" /&amp;gt;
                    &amp;lt;ISWebGrid:WebGridColumn ColumnType="Custom" Width="110px" AllowSizing="Yes" Name="Value" Caption="Value" /&amp;gt;
                &amp;lt;/Columns&amp;gt;
            &amp;lt;/RootTable&amp;gt;
            &amp;lt;LayoutSettings AllowEdit="No" 
                AlternatingColors="false" 
                GridLines="Horizontal" 
                PagingMode="None"
                AutoHeight="true"
                AutoFitColumns="false"
                StatusBarVisible="false"&amp;gt;
                &amp;lt;AlternatingRowStyle CustomRules="text-overflow: ellipsis; overflow: hidden;" Wrap="false" BackColor="White" Font-Size="8pt" Font-Names="Arial Monospaced"&amp;gt;&amp;lt;/AlternatingRowStyle&amp;gt;
                &amp;lt;RowStyle CustomRules="text-overflow: ellipsis; overflow: hidden;" Wrap="false" BackColor="White" Font-Size="8pt" Font-Names="Arial Monospaced"&amp;gt;&amp;lt;/RowStyle&amp;gt;
            &amp;lt;/LayoutSettings&amp;gt;
        &amp;lt;/ISWebGrid:WebGrid&amp;gt;&lt;/pre&gt;
&lt;p&gt;Code behind - this is what is execute after the post back:&lt;/p&gt;&lt;pre&gt;''' &amp;lt;summary&amp;gt;
    ''' binds this list to the grid
    ''' &amp;lt;/summary&amp;gt;
    ''' &amp;lt;param name="results"&amp;gt;&amp;lt;/param&amp;gt;
    ''' &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;
    Private Sub BindGrid(ByVal results As List(Of String()))
        ' Note (XXX): we can't bind the grid by simply setting the datasource property since this is a list of string arrays
        ' we have to iterate through the list and add each row manually
        If results IsNot Nothing Then
            For i As Integer = 0 To results.Count - 1
                Dim data As String() = results(i)
                Me.wbCompareResults.RootTable.Rows().Add(New ISNet.WebUI.WebGrid.WebGridRow(data))
            Next
        End If
    End Sub&lt;/pre&gt;
&lt;p&gt;Everything seems to bind just find, but my first row is never sized as it was.&lt;/p&gt;
&lt;p&gt;Thanks for your help!&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>