<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.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>ASP.NET Dynamic Data</title><link>http://forums.asp.net/1145.aspx</link><description>Discussions regarding the new scaffolding framework in ASP.NET</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Move GridView command column or dynamically append columns</title><link>http://forums.asp.net/thread/2917320.aspx</link><pubDate>Thu, 05 Feb 2009 04:03:43 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2917320</guid><dc:creator>ricka6</dc:creator><author>ricka6</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2917320.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2917320</wfw:commentRss><description>&lt;p&gt;Hey 10bulls,&lt;/p&gt;
&lt;p&gt;Thanks for posting your code. David tells me your solution is fine.&lt;/p&gt;</description></item><item><title>Re: Move GridView command column or dynamically append columns</title><link>http://forums.asp.net/thread/2914949.aspx</link><pubDate>Wed, 04 Feb 2009 09:53:13 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2914949</guid><dc:creator>10Bulls</dc:creator><author>10Bulls</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2914949.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2914949</wfw:commentRss><description>&lt;p&gt;Thank you very much for the quick reply and yes that worked.&lt;/p&gt;&lt;p&gt;Here is a snippet from my field generator ( adapted from DynamicDataFutures )&lt;/p&gt;&lt;p&gt;I&amp;#39;m not sure if this is the best way to go about it, but it seems to work and leaves me to get on beating my head against the next obstacle.&amp;nbsp;&lt;img src="http://forums.asp.net/emoticons/emotion-43.gif" alt="Confused" /&gt; &lt;br /&gt;&lt;/p&gt;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;public&lt;/span&gt; ICollection GenerateFields(Control control) {&lt;br /&gt;            &lt;span class="cmt"&gt;// Get all of table&amp;#39;s columns, take only the ones that should be automatically included in a fields collection,&lt;br /&gt;            // sort the result by the ColumnOrderAttribute, and for each column create a DynamicField&lt;/span&gt;&lt;br /&gt;            var fields = from column &lt;span class="kwd"&gt;in&lt;/span&gt; _table.Columns&lt;br /&gt;                         where IncludeField(column)&lt;br /&gt;                         orderby ColumnOrdering(column)&lt;br /&gt;                         select &lt;span class="kwd"&gt;new&lt;/span&gt; DynamicField() {&lt;br /&gt;                             DataField = column.Name,&lt;br /&gt;                             HeaderText = column.GetDisplayName() &lt;span class="cmt"&gt;// use extension method to refetch display name to work around localization bug&lt;/span&gt;&lt;br /&gt;                         };&lt;br /&gt;&lt;br /&gt;            &lt;br /&gt;            List&amp;lt;DynamicField&amp;gt; flds = fields.ToList();&lt;br /&gt;&lt;br /&gt;            &lt;span class="kwd"&gt;if&lt;/span&gt; (_table.PrimaryKeyColumns.Count &amp;gt; 0)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class="cmt"&gt;// get the first primary key field&lt;/span&gt;&lt;br /&gt;                DynamicField ctrl = &lt;span class="kwd"&gt;new&lt;/span&gt; DynamicField();&lt;br /&gt;                ctrl.HeaderText = &lt;span class="st"&gt;&amp;quot;Commands&amp;quot;&lt;/span&gt;;&lt;br /&gt;                ctrl.DataField = _table.PrimaryKeyColumns[0].Name;&lt;br /&gt;                ctrl.UIHint = &lt;span class="st"&gt;&amp;quot;GridCommand&amp;quot;&lt;/span&gt;;&lt;br /&gt;                flds.Add(ctrl);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;span class="kwd"&gt;return&lt;/span&gt; flds;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;Where GridCommand.ascx  is a field template &lt;/pre&gt;&lt;pre class="coloredcode"&gt;&amp;lt;%@ Control Language=&amp;quot;C#&amp;quot; CodeBehind=&amp;quot;GridCommand.ascx.cs&amp;quot; Inherits=&amp;quot;DynamicTest.GridCommand&amp;quot; %&amp;gt;&lt;br /&gt;&amp;lt;asp:DynamicHyperLink ID=&amp;quot;DetailsHyperLink&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;quot;Details&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Move GridView command column or dynamically append columns</title><link>http://forums.asp.net/thread/2914211.aspx</link><pubDate>Wed, 04 Feb 2009 04:02:56 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2914211</guid><dc:creator>davidfowl</dc:creator><author>davidfowl</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2914211.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2914211</wfw:commentRss><description>&lt;p&gt;The only way to do this would be to create your own IAutoFieldGenerator and add the command field at the end.&lt;/p&gt;</description></item><item><title>Move GridView command column or dynamically append columns</title><link>http://forums.asp.net/thread/2913829.aspx</link><pubDate>Tue, 03 Feb 2009 23:06:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2913829</guid><dc:creator>10Bulls</dc:creator><author>10Bulls</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2913829.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=2913829</wfw:commentRss><description>&lt;p&gt;Greetings all,&amp;nbsp; I am hoping you can save my crumbling sanity.&lt;/p&gt;&lt;p&gt;I have written a simple Dynamic Data application, displaying a scaffolded table to a GridView.&amp;nbsp; So far so good.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;All I would like to do is move the command column, with Edit Delete Insert etc (column(0) to the right most column.&lt;/p&gt;&lt;p&gt;I could do this by writing Custom Pages for each object, but I would like to do this for the generic PageTemplate.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;My thought was to create the command column in code and append it to the column collection but I am struggling with this.&lt;/p&gt;&lt;p&gt;I have tried creating a column in Page_Load, GridView_DataBound and GridView_PreRender events, but in each case the columns collection is empty at that point and the new column still ends up on this left.&lt;/p&gt;&lt;p&gt;When is the GridView ColumnsGenerator called?&amp;nbsp; I put a break point in a custom field generator but the call stack was not helpful.&lt;/p&gt;&lt;p&gt;Thanks for your time and sorry if this has come up before, but hours of searching have drawn a blank.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>