<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Lance Ahlberg's WebLog - All Comments</title><link>http://weblogs.asp.net/lancea/default.aspx</link><description>Reflection on reason</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Debug Build: 20510.895)</generator><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#7169048</link><pubDate>Fri, 14 Aug 2009 05:55:25 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7169048</guid><dc:creator>Ovidiu Petruescu</dc:creator><description>&lt;p&gt;The easiest way to do this is to extend the BoundField and provide your own implementation for GetValue&lt;/p&gt;
&lt;p&gt;For Example:&lt;/p&gt;
&lt;p&gt;public class EnhancedBoundField : BoundField&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;protected override object GetValue(Control controlContainer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;object component = null;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string dataField = this.DataField;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (controlContainer == null)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;throw new HttpException(&amp;quot;DataControlField_NoContainer&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;component = &amp;nbsp;DataBinder.GetDataItem(controlContainer);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if ((component == null) &amp;amp;&amp;amp; !base.DesignMode)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;throw new HttpException(&amp;quot;DataItem_Not_Found&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// use reflection to get the data from your child...&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7169048" width="1" height="1"&gt;</description></item><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#7159130</link><pubDate>Fri, 31 Jul 2009 23:41:19 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7159130</guid><dc:creator>Habeeb</dc:creator><description>&lt;p&gt;Remove the &amp;quot;[&amp;quot; &amp;quot;]&amp;quot; from the property name ([City.name]) and it work.&lt;/p&gt;
&lt;p&gt;By the way, nice post dude.&lt;/p&gt;
&lt;p&gt;Sometimes we need to spend hours to resolve silly issues with Microsoft products.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.habeebonline.com"&gt;http://www.habeebonline.com&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7159130" width="1" height="1"&gt;</description></item><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#6922582</link><pubDate>Sun, 22 Feb 2009 10:28:07 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6922582</guid><dc:creator>sprlengchai</dc:creator><description>&lt;p&gt;Sure. Solution as bellow. pls try again.&lt;/p&gt;
&lt;p&gt;&amp;lt;%# DataBinder.Eval(Container.DataItem, &amp;quot;AssociatedProduct.Name&amp;quot;) %&amp;gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6922582" width="1" height="1"&gt;</description></item><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#6829146</link><pubDate>Fri, 09 Jan 2009 19:12:05 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6829146</guid><dc:creator>Ricardo Rief</dc:creator><description>&lt;p&gt;Now I found another problem...&lt;/p&gt;
&lt;p&gt;How can I set this same property AssociatedProduct.Name as a DataKeyName?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6829146" width="1" height="1"&gt;</description></item><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#6697773</link><pubDate>Wed, 22 Oct 2008 12:25:28 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6697773</guid><dc:creator>Ricardo Rief</dc:creator><description>&lt;p&gt;It works perfectly for me!&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6697773" width="1" height="1"&gt;</description></item><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#6545274</link><pubDate>Thu, 21 Aug 2008 03:38:31 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6545274</guid><dc:creator>sprlengchai</dc:creator><description>&lt;p&gt;Well, in your grid view should write as bellow:&lt;/p&gt;
&lt;p&gt;&amp;lt;%# DataBinder.Eval(DataBinder.Eval(Container.DataItem, &amp;quot;AssociatedProduct&amp;quot;), &amp;quot;Name&amp;quot;)%&amp;gt;&lt;/p&gt;
&lt;p&gt;please try..&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6545274" width="1" height="1"&gt;</description></item><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#6337934</link><pubDate>Mon, 30 Jun 2008 02:31:35 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6337934</guid><dc:creator>Me</dc:creator><description>&lt;p&gt;This doesn't work.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6337934" width="1" height="1"&gt;</description></item><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#6087907</link><pubDate>Fri, 11 Apr 2008 16:44:15 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6087907</guid><dc:creator>xxxxx</dc:creator><description>&lt;p&gt;xcxcxc xcx cxcx cxcx cxcx cxcx cx cxc cxcxcxdsds dsds sasa sasa qwq wqwq wqwq wqwq &lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6087907" width="1" height="1"&gt;</description></item><item><title>Binding the GridView control to a complex (deep) business object</title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#5338348</link><pubDate>Mon, 26 Nov 2007 01:14:48 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5338348</guid><dc:creator>Binding the GridView control to a complex (deep) business object</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Binding the GridView control to a complex (deep) business object&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5338348" width="1" height="1"&gt;</description></item><item><title>re: Binding the GridView control to a complex (deep) business object </title><link>http://weblogs.asp.net/lancea/archive/2004/08/04/207770.aspx#5305535</link><pubDate>Wed, 21 Nov 2007 15:20:31 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:5305535</guid><dc:creator>jm</dc:creator><description>&lt;p&gt;hi, when i convert the boundfield to a templatefield it throw a ex.&lt;/p&gt;
&lt;p&gt;[City.name is not ....&lt;/p&gt;
&lt;p&gt;i have a Country Object with a city object inside and i want to populate country and city in the same gridview.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=5305535" width="1" height="1"&gt;</description></item></channel></rss>