﻿<?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 - Button in column header</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Button-in-column-header/</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>Button in column header</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Button-in-column-header/</link><pubDate>Fri, 19 Mar 2010 02:25:17 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><description>&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Hi Rob,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Sorry, but our WebGrid does not support that feature. However, we can use ColumnAction, so, there is a context menu if you click on the column header and create a new menu item to it&amp;nbsp;and works as a new function to it for the workaround.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; First, we need to show the column action in the WebGrid by:&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; "&gt;        &amp;lt;LayoutSettings ShowColumnAction="True"&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Then, using the OnColumnContextMenu client action, we can create a new item and call a new function. Here is the snippet:&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; "&gt;        function WebGrid1_OnColumnContextMenu(controlId, col, menu, isGroup, location)
        {
            var WebGrid1 = ISGetObject(controlId);
            
            var separator = new WebMenuItem();
            separator.Type = "Separator";
            separator.Name = "MySeparator";

            var menuItem = new WebMenuItem();
            menuItem.Text = "New Function";
            menuItem.Name = "MyMenu";
            menuItem.OnClick = "newFunction";

            menu.Items.Add(separator);
            menu.Items.Add(menuItem);
            return true;
        }

        function newFunction()
        {
            alert("This is a new function");
        }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;I hope it helps. Thank you and have a nice day.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Andi Santoso&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>Button in column header</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Button-in-column-header/</link><pubDate>Thu, 18 Mar 2010 08:38:36 GMT</pubDate><dc:creator>rdelloro</dc:creator><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;I've a question about webgrid &lt;/p&gt;
&lt;p&gt;I'ts is possible add inside a column header a button?&lt;/p&gt;</description></item></channel></rss>