﻿<?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 - Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</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>Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</link><pubDate>Mon, 28 Jun 2010 09:50:02 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;Sure, I will create a wi for this feature request.&lt;/p&gt;&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</link><pubDate>Fri, 25 Jun 2010 08:13:21 GMT</pubDate><dc:creator>PRISMAY</dc:creator><description>&lt;blockquote&gt;&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;Thank you for your feedback. Unfortunately, it is not a bug. The current method can only open SelfRefRow in one level, not all SelfRefRow include the child.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Handy,&lt;/p&gt;
&lt;p&gt;Would you kindly submit it as a feature request please?  It would really be helpful to not have to do this programmatically, i.e., when you select a specific node to expand, it should, when rendered, have its parents expanded too.  That behavior, at least to me, seems to be the obvious one and is what I had expected.  Thanks a lot.&lt;/p&gt;</description></item><item><title>Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</link><pubDate>Thu, 24 Jun 2010 23:09:54 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;Thank you for your feedback. Unfortunately, it is not a bug. The current method can only open SelfRefRow in one level, not all SelfRefRow include the child. &lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;</description></item><item><title>Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</link><pubDate>Thu, 24 Jun 2010 11:42:14 GMT</pubDate><dc:creator>PRISMAY</dc:creator><description>&lt;p&gt;Okay, I found a way to work around the issue above which still should have worked and I'd consider it a bug.  In our workaround, we were lucky in that the keys contained what we need to start expanding at the parent and work our way down.&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;foreach (string strKey in FoundItemKeyValueList)
{
    // get our find target and current row's key and move its individual ids
    // into their own arrays so we can compare and drill down to our found
    // target by expanding the parent rows
    string[] arFoundIds = strKey.Split(',');
    string[] arCurrentIds = e.Row.KeyValue.ToString().Split(',');

    // if we match our key fully, then we're at our target so we do not need
    // to expand anything but we do need to select it
    if (strKey == e.Row.KeyValue.ToString())
    {
        // and then select our item
        e.Row.Selected = true;
    }
    // if we haven't found our target yet, then expand the parent where our
    // target lives until we get to it.  We determine this by checking
    // our current row against our target at the current level which would
    // have the same key IDs
    else if (arFoundIds[e.Row.SelfRefLevel] == arCurrentIds[e.Row.SelfRefLevel])
    {
        e.Row.ExpandSelfRefRow();
    }
}
&lt;/pre&gt;</description></item><item><title>Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</link><pubDate>Thu, 24 Jun 2010 10:50:52 GMT</pubDate><dc:creator>PRISMAY</dc:creator><description>&lt;p&gt;Handy,&lt;/p&gt;
&lt;p&gt;This is working but not as expected.  Unfortunately, it's not expanding the entire levels above the item.  For example, if I have the following:&lt;/p&gt;&lt;pre&gt;- Item 1
-    Item 1-1
&amp;#43;       Item 1-1-1
-       Item 1-1-2
           Item 1-1-2-1
&amp;#43;    Item 1-2&lt;/pre&gt;If I need to select and expand to item 1-1-2-1, the grid comes up like this&lt;pre&gt;&amp;#43; Item 1
           Item 1-1-2-1
&amp;#43;    Item 1-2
&lt;/pre&gt;
&lt;p&gt;I tried the following code to expand everything going up in the InitializeRow override but it does not work:&lt;/p&gt;&lt;pre&gt;if (strKey == e.Row.KeyValue.ToString())
{
    // select our item
    e.Row.Selected = true;

    // expand all the rows from the bottom up
    WebGridRow oWorkRow = e.Row.SelfRefParentRow;
    while (oWorkRow != null)
    {
        oWorkRow.ExpandSelfRefRow();
        oWorkRow = oWorkRow.SelfRefParentRow;
    }
}
&lt;/pre&gt;
&lt;p&gt;How can I get the grid to expand all the parents too?&lt;/p&gt;</description></item><item><title>Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</link><pubDate>Thu, 24 Jun 2010 08:10:57 GMT</pubDate><dc:creator>PRISMAY</dc:creator><description>&lt;p&gt;Great, thank you Handy.  I'll give this a try today and see how it goes.&lt;/p&gt;</description></item><item><title>Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</link><pubDate>Thu, 24 Jun 2010 04:39:33 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;Hi Yousif,&lt;/p&gt;&lt;p&gt;If you want to expand the row when loading WebGrid, I suggest you to handle the code at InitializeRow serverside event.&lt;/p&gt;
&lt;p&gt;e.g... some KeyValue are not in string object. So, sometimes, you will need to convert into string.&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt; protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)
    {
        if (e.Row.KeyValue.ToString() == "1")
        {
            e.Row.ExpandSelfRefRow();
        }
    }&lt;/pre&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>Expand Self Reference Grid Programmatically To Specific Child Row</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Expand-Self-Reference-Grid-Programmatically-To-Specific-Child-Row/</link><pubDate>Wed, 23 Jun 2010 13:18:24 GMT</pubDate><dc:creator>PRISMAY</dc:creator><description>&lt;p&gt;Is there a way to load the grid and have it expand automatically to a specific row based on the row key?  Even if the grid can't do this via properties, how can this be accomplished programmatically on both server and client side?  Thank you.&lt;/p&gt;</description></item></channel></rss>