Hi all I have one checkbox and one grid in my page. I want to hide one column of the grid when check box is checked. I have binded data at pageload. This checkbox is just to make columns visible or invisible. Whenever i check this checkbox its firing an event which loads my page again. Is there any way to hide that column without doing whole page load.
Any suggestions will be highly appreciated.
Hello,
Yes, I think this is possible by using the client side object model (CSOM) of the grid. You can check out the Column CSOM documented here:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR2.0/html/WebGrid_Column_Object_CSOM.html
and use the setHidden function in particular to hide a column of the grid on the client-side without postback.. This can be executed on a client-side event of the checkbox, e.g.
<input type=checkbox onclick="hideColumn()" ... />
Hope this helps.
The above link is not working. Can you please send me this link again...
Thanks
Sure, sorry for that.
This is the link.
Thanks for your reply.....It works for me.....But there is something wrong in your code. You have written parenthesis bracket. It should be box bracket instead of parenthesis. And the boolean value will come as a argument inside setHidden() method.
My Code
function hideColumn() {
var grid = igtbl_getGridById("<%= UltraWebGrid1.ClientID %>");
grid.Bands[0].getColumnFromKey("CategoryName").setHidden(true);
}
Thanks again. I appreciate your help.
You can use the CSOM (client-side object model of the grid) and do something like that:
<input type=checkbox onclick="hideColumn()" ... /><script type="text/javascript">function hideColumn(){ var grid = igtbl_getGridById("<%= UltraWebGrid1.ClientID %>"); grid.Bands(0).getColumnFromKey("ColumnKey").setHidden();}</script>
More info can be found in our online help
http://help.infragistics.com
in the CSOM section of the grid.
I am still looking for solution to this problem. Is anyone there knows how to implement javascript for this event?
Thanks for your response. Could you please send me some sample code. I have tried to inculde Javascripfile and trying to hide the column in the grid at OnClick = HideColumn(). But still its not working.
I am not good in JavaScript. Here is my sample code
<
asp:CheckBox ID="SprayBoothCheckBox" runat="server" Text="Spray Booth" onclick="hideColumn()" />
function
onclick() {
ManagementDetailsUltraWebGrid.Columns.FromKey(
"spraybooth").Hidden = true;
Thanks in advance