﻿<?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 - Show/Hide WebGrid column in JavaScript</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ShowHide-WebGrid-column-in-JavaScript/</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>Show/Hide WebGrid column in JavaScript</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ShowHide-WebGrid-column-in-JavaScript/</link><pubDate>Mon, 08 Mar 2010 21:16:43 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;The mechanism to show/hide WebGrid column that is used in SetVisibilityColumn.aspx sample file (in post #2) is by accessing the html element of the column header and column group; and then set their &lt;em&gt;&lt;strong&gt;display&lt;/strong&gt;&lt;/em&gt; style property to ‘&lt;strong&gt;none&lt;/strong&gt;’. This method will make the column look as though disappear. The fact, the column actually exists in client browser, only the display property that is set to ‘none’.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;SetChildTableColumnVisibilityAtClientSide.aspx sample file (in post #4) uses &lt;strong&gt;Visible&lt;/strong&gt; property of WebGridColumn class. When user click the button, the page will postback – thanks to WebFlyPostBackManager that make the postback becomes FlyPostBack. Then when the Visible property is set to ‘false’, the grid that shows on the client browser will have new structure, the one without the corresponding column. Not like the first scenario, where the column is being hidden (exist but not displayed), this approach will completely remove the element of the column. Due to this reason, I hope it explains why can’t you access the column on the client side to update the value when set Visible property to ‘false’.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;In order to access column value without showing the column on the grid, I suggest you to check the “&lt;strong&gt;HiddenDataMember&lt;/strong&gt;” feature of WebGrid. This property allows you to render specified hidden data member along with the cell as pseudo attribute. You can easily retrieve the hidden member’s value in client side by accessing the dataMember directly. Example:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;alert(cell.ProductID);&lt;/pre&gt;

&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;You may refer to “&lt;strong&gt;How-to: Use HiddenDataMember to get value from hidden column&lt;/strong&gt;” that available in WebGrid documentation or “&lt;strong&gt;WriteHiddenDataMember.aspx&lt;/strong&gt;” tutorial file in WebGridTutorial project.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Show/Hide WebGrid column in JavaScript</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ShowHide-WebGrid-column-in-JavaScript/</link><pubDate>Mon, 08 Mar 2010 10:03:54 GMT</pubDate><dc:creator>jcrendulic</dc:creator><description>&lt;p&gt;I tried this example.  The problem is that when I have set it to .visible = false on the server side, I can not access the column on the client side to update the value.  Is there abother way to access the column's value without showing the column on the grid?&lt;/p&gt;</description></item><item><title>Show/Hide WebGrid column in JavaScript</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ShowHide-WebGrid-column-in-JavaScript/</link><pubDate>Fri, 05 Mar 2010 04:36:53 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;It is possible to hide child table column in hierarchical WebGrid scenario on client side event by using the same method as shown in the “SetColumnVisibilityAtClientSide.zip” sample file on the previous post. However, this would require a lot of effort, since we’ll need to open/expand the child table and then set the display property of the particular column header and column group.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;For hierarchical WebGrid scenario, I suggest you to use server side event instead of client side event. By using server side event, it’s simply set the visibility property of the child table column to false in order to hide the column (as show in the snippet code below).&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;WebGrid1.RootTable.ChildTables.GetNamedItem("Products").Columns.GetNamedItem("SupplierID").Visible = false;&lt;/pre&gt;

&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;I enclosed one simple sample (as attachment) of hierarchical WebGrid that shows how to hide “SupplierID” column in Categories-Products hierarchical table relationship from Northwind.mdb database. In this sample, I also use WebFlyPostBackManager in order to make the page fly postback when user clicks the WebButton.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;For more detail information, please check the code in the attached sample file.&lt;br /&gt;Please let me know whether this help or not.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Show/Hide WebGrid column in JavaScript</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ShowHide-WebGrid-column-in-JavaScript/</link><pubDate>Thu, 04 Mar 2010 15:53:52 GMT</pubDate><dc:creator>jcrendulic</dc:creator><description>&lt;p&gt;How would you set the column to hidden on the client side for a child grid column?&lt;/p&gt;</description></item><item><title>Show/Hide WebGrid column in JavaScript</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ShowHide-WebGrid-column-in-JavaScript/</link><pubDate>Wed, 18 Nov 2009 02:55:15 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;WebGrid column visibility can’t be set to false on client side in order to hide the column, because the column already rendered by browser. But there is a workaround to hide/show WebGrid column from client side. Simply set the display property of the column header element and column group to “none”. For detail information, please check the attached sample code.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Show/Hide WebGrid column in JavaScript</title><link>http://www.intersoftsolutions.com/Community/WebGrid/ShowHide-WebGrid-column-in-JavaScript/</link><pubDate>Tue, 17 Nov 2009 02:59:17 GMT</pubDate><dc:creator>sarabjeetmarwah</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;How can i show/hide a column of webgrid from javascript.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Sarbajeet Singh Marwah&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>