﻿<?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 - Get KeyValue when webgrid mode is group by (GroupHeader)</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Get-KeyValue-when-webgrid-mode-is-group-by-GroupHeader/</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>Get KeyValue when webgrid mode is group by (GroupHeader)</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Get-KeyValue-when-webgrid-mode-is-group-by-GroupHeader/</link><pubDate>Thu, 25 Feb 2016 08:09:38 GMT</pubDate><dc:creator>yudi</dc:creator><category>WebGrid</category><category>keyvalue</category><category>GroupHeader</category><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;OnCellClick client-side event specifies the client side (JavaScript) function that will be invoked when a cell is clicked. It has following event parameter: controlId, tblName, rowIndex, cellIndex, cellEl.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Following snippet code shows how to obtain row's key value in OnCellClick client-side event. Instead of using rowIndex, &lt;strong&gt;cellEl&lt;/strong&gt; parameter is used to obtain row object through &lt;strong&gt;GetRowByElement(&lt;/strong&gt;&lt;em&gt;element&lt;/em&gt;&lt;strong&gt;)&lt;/strong&gt; method.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;function WebGrid1_OnCellClick(controlId, tblName, rowIndex, cellIndex, cellEl)
{
    // get WebGrid object
    var grid = ISGetObject(controlId);

    // get row object
    var rowObj = grid.GetRowByElement(cellEl);

    if (rowObj.Type == "Record")
        alert("Key value of selected row is: " + rowObj.KeyValue);

    return true;
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;This should helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Get KeyValue when webgrid mode is group by (GroupHeader)</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Get-KeyValue-when-webgrid-mode-is-group-by-GroupHeader/</link><pubDate>Wed, 24 Feb 2016 13:18:59 GMT</pubDate><dc:creator>sjain</dc:creator><category>WebGrid</category><category>keyvalue</category><category>GroupHeader</category><description>&lt;p&gt;Hi,&lt;/p&gt;        &lt;p&gt;I went through your documentation for getting keyvalue when we do wedbgrid in groupby mode.&lt;/p&gt;    
    &lt;p&gt;https://www.intersoftsolutions.com/Support/WebGrid/Documentation/topic495.html&lt;/p&gt;
    &lt;pre&gt;function GetCellText()
{
    var grid = ISGetObject("WebGrid1");
    var curSelObj = grid.GetSelectedObject(); // get selected object

    if (curSelObj == null)
    {
        alert("No row selected. Please select a row");
    }
    else
    {
        var row = curSelObj.GetRowObject(); // get the WebGridRow object

        if (row.Type == "GroupHeader")
        {
            alert("Currently selected row is a Group Row. There is no cell information.");
        }
        else if (row.Type == "Record")
        {
            var cells = row.GetCells(); // obtain WebGridCellCollection of the specified row.
            var addressCell = cells.GetNamedItem("Address"); // get the address' WebGridCell object by name.

            alert("Current selected row's Address cell has this text : " + addressCell.Text + "\nThe cell's value is : " + (addressCell.Value == null ? "No Value" : addressCell.Value));
        }
    }
}&lt;/pre&gt;
    
    &lt;p&gt;on the above method you have clearly mentoined when record type is GroupHeader then "Currently selected row is a Group Row. There is no cell information".&lt;/p&gt;
    &lt;p&gt;I need KeyValue when webgrid is in Group by mode on OnCellClick(controlId, tblName, rowIdx, cellIdx, cellElm) event.&lt;/p&gt;
    &lt;p&gt;I am able to get keyvalue when grid is NOT IN group by mode as bellow:&lt;/p&gt;
    &lt;pre&gt;var WebRow = WebGrid1.RootTable.GetRow(rowIdx);

if (WebRow != null)
{
    if ((ColumnName == "XYZ") &amp;amp;&amp;amp; rowIdx != -1)
    {
        if ((browserDocumentMode &amp;gt;= 11 &amp;amp;&amp;amp; cellElm.childElementCount &amp;gt; 0) || (browserDocumentMode &amp;lt; 11 &amp;amp;&amp;amp; cellElm.all.length &amp;gt; 0))
        {
            openDetails(WebRow.KeyValue);
        }
    }
}&lt;/pre&gt;
    &lt;p&gt;Please reply ASAP.&lt;/p&gt;
    &lt;br&gt;
    &lt;p&gt;Regards&lt;/p&gt;
    &lt;p&gt;Sachin Jain&lt;/p&gt;</description></item></channel></rss>