﻿<?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 - OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</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>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Thu, 09 Aug 2012 23:41:16 GMT</pubDate><dc:creator>Hans</dc:creator><description>Hello,&lt;br /&gt;&lt;br /&gt;I’m glad that you have found a work around.&lt;br /&gt;&lt;br /&gt;Thank you for your feedback.&lt;br /&gt;I made a sample base on your code, but unfortunately, I can’t replicate your issue on my end.&lt;br /&gt;I use Nortwind database and Customers table in my sample.&lt;br /&gt;&lt;br /&gt;I attached my sample. Please have a review on my sample and let me know if there are settings that I missed.&lt;br /&gt;&lt;br /&gt;Could you provide me your WebGrid and Framework in your current project?&lt;br /&gt;&lt;br /&gt;Thank you.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Thu, 09 Aug 2012 16:11:45 GMT</pubDate><dc:creator>adajani@najiasystems.com</dc:creator><description>It's fine I found a work around.&lt;br /&gt;&lt;br /&gt;I would like to inform your developers of one thing that has been an issue. Sometimes when I hide a column, then run the following code on client side, the invisible columns are always at the end. &lt;br /&gt;&lt;br /&gt;For example, if I create the columns as &lt;br /&gt;col1:visible, col2:visible, col3:invisible, col4:visible, col5:visible &lt;br /&gt;then run my code, I get the following:&lt;br /&gt;col1:visible, col2:visible, col4:visible, col5:visible, col3:invisible&lt;br /&gt;&lt;br /&gt;I don't understand why but I hope it is addressed with the next hot fix.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;var grid = ISGetObject('myGrid');            var settings = "";
            for (var i = 0; i &amp;lt; grid.RootTable.Columns.length; i&amp;#43;&amp;#43;) {
                    if (settings.length != 0 &amp;amp;&amp;amp; i &amp;lt; grid.RootTable.Columns.length) {
                        settings &amp;#43;= ","
                    }
                    settings &amp;#43;= grid.RootTable.Columns[i].Name &amp;#43; ":" &amp;#43; grid.RootTable.Columns[i].Width &amp;#43; "px:" &amp;#43; grid.RootTable.Columns[i].Visible;
            }&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;
</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Mon, 06 Aug 2012 04:30:18 GMT</pubDate><dc:creator>Hans</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for your information and code.&lt;br /&gt;&lt;br /&gt;I made a simple sample that maybe similar with your scenario.&lt;br /&gt;I adding the columns during the PrepareDataBinding event server side as well.&lt;br /&gt;&lt;br /&gt;However I still can’t reproduce your issue on my end.&lt;br /&gt;Would you mind to modify my sample, so it can replicate your issue? And could you please tell me the setting that I’ve missed in my sample?&lt;br /&gt;&lt;br /&gt;Thank you.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Fri, 03 Aug 2012 12:06:00 GMT</pubDate><dc:creator>adajani@najiasystems.com</dc:creator><description>Actually there are lots of files involved...But here is the scenario.&lt;br /&gt;&lt;br /&gt;- Same grid as above. I am dynamically adding the columns during the PrepareDataBinding event server side.&lt;br /&gt;&lt;br /&gt;- User clicks a button, opens an iFrame window popup to choose the grid columns they want. When the iFrame posts back. It sends a comma dilimited string to the parent window through js (parent.modalCallback(callBackParams) which is assigned to returnObj.&amp;nbsp; You retreive the value as returnObj.newColumnSettings.&lt;br /&gt;&lt;br /&gt;So,&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;parent.aspxfunction openPopup() {
  // I'm not using showModalDialog anymore. I'm using the JQuery ColorBox plugin, but I am adding this code as an explanation
  var returnObj = window.showModalDialog(URL, args, "edge:Raised;scroll:no;help:no;status:no;center:yes;resizable:no;dialogHeight:350px;dialogWidth:600px;dialogLeft:48px;dialogTop:50px;");
  var grid = ISGetObject(myGrid);
                            var columnSettings = returnObj.newColumnSettings.split(",");
                            for (var i = 0; i &amp;lt; columnSettings.length; i&amp;#43;&amp;#43;) {
                                var settingTokens = columnSettings[i].split(":");
                                if (settingTokens[1] == "SHOW") {
                                    if (!grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible) {
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible = true;
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Show();
                                    }
                                }
                                else if (settingTokens[1] == "HIDE") {
                                    if (grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible) {
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible = false;
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).HideFromView();
                                    }
                                }
                            }
                            wgDoResize(true, true);
// this call posts back to the server so I can the new grid layout
refreshPage();
}&lt;/pre&gt;
&lt;p&gt;Now...the popup&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;function closeWindow(callbackParams) {
// call back params is an object in this case looks like {message: "some message", newColumnSettings: "a,comma,delim,string" }
                parent.modalCallback(callbackParams);
}
&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Thu, 02 Aug 2012 23:54:35 GMT</pubDate><dc:creator>Hans</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for the code.&lt;br /&gt;&lt;br /&gt;Could you provide me more information about your code?&lt;br /&gt;For example, where do you get the value of “returnObj”? Or what function and how you call the function to hide the column?&lt;br /&gt;&lt;br /&gt;Or if you don’t mind, could you provide me a simple sample that replicate this issue?&lt;br /&gt;&lt;br /&gt;So I can help you to investigate this issue further more.&lt;br /&gt;&lt;br /&gt;Thank you.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Thu, 02 Aug 2012 15:45:17 GMT</pubDate><dc:creator>adajani@najiasystems.com</dc:creator><description>&lt;p&gt;Hans,&lt;br /&gt;&lt;br /&gt;It seems there is another issue with this approach...When I try to execute the following code in the JS, I always get a JS error as listed below. It seems to always break on either Show() or HideFromView();&lt;br /&gt;&lt;br /&gt;Any ideas?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;TypeError: va7744 is null[Break On This Error] 	...30); if (ve2630.tagName =="TR" ||ve2630.tagName =="TD") return wgab058.m3c386(ve...
ISRes....7200533 (line 9)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;                            var grid = ISGetObject(myGrid);
                            var columnSettings = returnObj.newColumnSettings.split(",");
                            for (var i = 0; i &amp;lt; columnSettings.length; i&amp;#43;&amp;#43;) {
                                var settingTokens = columnSettings[i].split(":");
                                if (settingTokens[1] == "SHOW") {
                                    if (!grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible) {
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible = true;
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Show();
                                    }
                                }
                                else if (settingTokens[1] == "HIDE") {
                                    if (grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible) {
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).Visible = false;
                                        grid.RootTable.Columns.GetNamedItem(settingTokens[0]).HideFromView();
                                    }
                                }
                            }
                            wgDoResize(true, true);&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I'm passing in a string that looks like colName:SHOW,colName:HIDE,colName:SHOW. I've confirmed that the strings are being split correctly as well.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;Thanks!&lt;br /&gt;
</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Wed, 01 Aug 2012 21:41:21 GMT</pubDate><dc:creator>Hans</dc:creator><description>Hello,&lt;br /&gt;&lt;br /&gt;I’m glad to hear that you have found the solution for your project’s scenario.&lt;br /&gt;Should you have further question, please do not hesitate to contact us.&lt;br /&gt;&lt;br /&gt;Thank you.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Wed, 01 Aug 2012 11:03:39 GMT</pubDate><dc:creator>adajani@najiasystems.com</dc:creator><description>This solution worked, but I had to add wgDoResize(true, true); after the call or else the columns would render weird on the grid.&lt;br /&gt;</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Wed, 01 Aug 2012 02:18:49 GMT</pubDate><dc:creator>Hans</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for your information.&lt;br /&gt;&lt;br /&gt;I made a simple sample to demonstrate how to hide and show WebGrid column from client side.&lt;br /&gt;I bind the WebGrid to access data source (Northwind.mdb database &amp; Shippers table).&lt;br /&gt;In my sample, I try to hide\show Phone column using WebButton’s OnClientClick client side event.&lt;br /&gt;Here’s the snippet code in OnClientClick:&lt;/p&gt;&lt;pre&gt;function WebButton1_OnClientClick(controlId, parameter) {    var WebButton1 = ISGetObject(controlId);
    var WebGrid1 = ISGetObject("WebGrid1");
    if (!WebGrid1.RootTable.Columns.GetNamedItem("Phone").Visible) {
        WebGrid1.RootTable.Columns.GetNamedItem("Phone").Visible = true;
        WebGrid1.RootTable.Columns.GetNamedItem("Phone").Show();
    } else {
        WebGrid1.RootTable.Columns.GetNamedItem("Phone").Visible = false;
        WebGrid1.RootTable.Columns.GetNamedItem("Phone").HideFromView();
    }
    return true;
}&lt;/pre&gt;
&lt;p&gt;However, if you want to make any changes to your Webgrid’s column, for example adding new columns, the structure is changed and could not be modified easily without fullpostback.&lt;br /&gt;&lt;br /&gt;In my humble opinion, I recommended you to handle all your WebGrid’s changes using fullpostback event. So you could easier to handle all your WebGrid’s changes.&lt;br /&gt;&lt;br /&gt;I attached my sample as well. Please have review on my sample.&lt;br /&gt;&lt;br /&gt;Thank you.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Tue, 31 Jul 2012 14:05:40 GMT</pubDate><dc:creator>adajani@najiasystems.com</dc:creator><description>Hi Hans,&lt;br /&gt;&lt;br /&gt;Unfortunately I cannot use this approach in my code due to the nature of how we are creating the grid.&lt;br /&gt;&lt;br /&gt;I now have another problem. When I initially load the grid, I am able to right click a column header and select "Remove This Column". The column is removed just fine. Then if I create another post back to try and change the columns, then, right click column header and chose "Remove This Column" The column disappears and reappears again with in a second. Have you ever encountered this? The same happens with resizing the column. The size just doesn't take.&lt;br /&gt;&lt;br /&gt;To recreate:&lt;br /&gt;&lt;br /&gt;1. Use the same grid markup above&lt;br /&gt;2. Client side dynamically add a bunch of columns.&lt;br /&gt;3. Try "Remove this column"&lt;br /&gt;4. Then create a post back and change the columns from the server side&lt;br /&gt;5. Try step 3 again.&lt;br /&gt;&lt;br /&gt;Another thing I'd like to be able to do is call "Remove This Column" on any column from my JavaScript code. How can I do that? Example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;script type="text/javascript"&amp;gt;function removeColumn(colName) {
var grid = ISGetObject(gridName);
var col = grid.RootTable.Columns.GetNamedITem(colName);
// How can I do this step?
col.Visible = false;
// here I would like to create a post  back to the server so I can do some modification to my column list on the server side. 
refreshPage();
}
&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;Thanks!&lt;br /&gt;
</description></item><item><title>OnColumnResize Client Side Event, Removing Columns and PostBack</title><link>http://www.intersoftsolutions.com/Community/WebGrid/OnColumnResize-Client-Side-Event-Removing-Columns-and-PostBack/</link><pubDate>Thu, 26 Jul 2012 11:06:57 GMT</pubDate><dc:creator>adajani@najiasystems.com</dc:creator><description>&lt;p&gt;I am dynamically adding columns to my grid.&lt;/p&gt;
&lt;p&gt;1. I am able to right click a column and choose "Remove this colum." Sometimes it works and removes, other times it doesn't. Have you ever had this behavior?&lt;/p&gt;
&lt;p&gt;2. I'd like to be able to refresh the grid everytime a column is resized so I can do some processing on the server. If I do a grid refresh inside the OnColumnResize client side event, it seems the width of the column is still not set to the new width. When client event can I use to post back after OnColumnResize?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;My Grid looks like this:&lt;/p&gt;&lt;pre&gt;&amp;lt;ISWebGrid:WebGrid ID="myGrid" runat="server" Height="560px" Width="100%" UseDefaultStyle="true" EnableWebResources="Always"
                           DataSourceID="odsAccountLineList" CustomSchemaRetrieval="UseWebGrid"&amp;gt;
            &amp;lt;RootTable GridLineStyle="NotSet" DataKeyField="account_line_id"&amp;gt;
            &amp;lt;/RootTable&amp;gt;
            &amp;lt;LayoutSettings DisplayDetailsOnUnhandledError="true"
                            InProgressUIBehavior="ChangeCursorToHourGlass" StatusBarVisible="true"
                            NewRowLostFocusAction="AlwaysUpdate"
			                RowLostFocusAction="AlwaysUpdate" 
                            AllowColumnMove="Yes"
			                AllowFilter="No" 
                            AllowGrouping="No" 
                            AllowSelectColumns="Yes" 
                            AllowSorting="No"
			                GroupByBoxVisible="false" 
                            AutoHeight="false" 
                            AutoWidth="true" 
                            PagingMode="None"
                            AllowEdit="Yes" 
                            AllowDelete="Yes"
                            AllowMultipleSelection="Yes"
                            UseRelativePositioning="true"&amp;gt;
                &amp;lt;AlternatingRowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="LightGray" Wrap="false" Font-Size="8pt" Font-Names="Arial Monospaced"&amp;gt;&amp;lt;/AlternatingRowStyle&amp;gt;
                &amp;lt;RowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="White" Font-Size="8pt" Wrap="false" Font-Names="Arial Monospaced"&amp;gt;&amp;lt;/RowStyle&amp;gt;
                &amp;lt;ClientSideEvents OnRowContextMenu="myGrid_OnRowContextMenu" OnColumnContextMenu="myGrid_OnColumnContextMenu" 
                    OnColumnResize="myGrid_OnColumnResize" /&amp;gt;
		    &amp;lt;/LayoutSettings&amp;gt;
        &amp;lt;/ISWebGrid:WebGrid&amp;gt;&lt;/pre&gt;
&lt;p&gt;Thanks.&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>