<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

      <title>Comments on: Custom header row in .NET datagrid?</title>
      <link>http://ask.metafilter.com/89107/Custom-header-row-in-NET-datagrid/</link>
      <description>Comments on Ask MetaFilter post Custom header row in .NET datagrid?</description>
	  	  <pubDate>Thu, 17 Apr 2008 14:02:38 -0800</pubDate>
      <lastBuildDate>Thu, 17 Apr 2008 14:02:38 -0800</lastBuildDate>
      <language>en-us</language>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <ttl>60</ttl>

<item>
  	<title>Question: Custom header row in .NET datagrid?</title>
  	<link>http://ask.metafilter.com/89107/Custom-header-row-in-NET-datagrid</link>	
  	<description>How do I insert a row of identical drop-down lists into the top of my .NET datagrid? I have a DataGrid whose source is an excel spreadsheet. My GUI needs to allow a user to select an option from a drop-down above each column. I&apos;d like this row to be a part of the grid so that everything lines up all pretty-like. &lt;br&gt;
&lt;br&gt;
The best option I&apos;ve found is to manually create all the rows and columns and bind that to the grid. Another option was to use a repeater of datalists instead. Is there a simpler or better way? (I&apos;m using C#)</description>
  	<guid isPermaLink="false">post:ask.metafilter.com,2008:site.89107</guid>
  	<pubDate>Thu, 17 Apr 2008 13:39:31 -0800</pubDate>
  	<dc:creator>TimeTravelSpeed</dc:creator>
	
	<category>net</category>
	
	<category>c</category>
	
	<category>datagrid</category>
	
	<category>datalist</category>
	
	<category>html</category>
	
	<category>aspx</category>
	
</item>
<item>
  	<title>By: TimeTravelSpeed</title>
  	<link>http://ask.metafilter.com/89107/Custom-header-row-in-NET-datagrid#1309885</link>	
  	<description>I should clarify that the loaded spreadsheet is different every single time. The solution needs to dynamically apply to spreadsheets of arbitrary size and with arbitrary column names.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.89107-1309885</guid>
  	<pubDate>Thu, 17 Apr 2008 14:02:38 -0800</pubDate>
  	<dc:creator>TimeTravelSpeed</dc:creator>
</item>
<item>
  	<title>By: sanko</title>
  	<link>http://ask.metafilter.com/89107/Custom-header-row-in-NET-datagrid#1310136</link>	
  	<description>You&apos;ll have to use a gridview for this, but it should work (adds a dropdown after the header row.)  &lt;br&gt;
&lt;br&gt;
&lt;code&gt;&lt;br&gt;
  protected void foo_DataBound1(object sender, EventArgs e)&lt;br&gt;
    {&lt;br&gt;
&lt;br&gt;
    &lt;br&gt;
        GridViewRow row = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal);&lt;br&gt;
        for (int i=0; i&lt;2&gt;
        {&lt;br&gt;
            DropDownList ddl = new DropDownList();&lt;br&gt;
            ddl.Items.Add(&amp;quot;foo&amp;quot;);&lt;br&gt;
            ddl.Items.Add(&amp;quot;bar&amp;quot;);&lt;br&gt;
            TableCell tc = new TableCell();&lt;br&gt;
            tc.Controls.Add(ddl);&lt;br&gt;
            row.Cells.Add(tc);&lt;br&gt;
        }&lt;br&gt;
&lt;br&gt;
        (sender as GridView).Controls[0].Controls.AddAt(1, row);&lt;br&gt;
       &lt;br&gt;
&lt;br&gt;
    }&lt;br&gt;
 &lt;/2&gt;&lt;/code&gt;</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.89107-1310136</guid>
  	<pubDate>Thu, 17 Apr 2008 16:42:40 -0800</pubDate>
  	<dc:creator>sanko</dc:creator>
</item>
<item>
  	<title>By: sanko</title>
  	<link>http://ask.metafilter.com/89107/Custom-header-row-in-NET-datagrid#1310142</link>	
  	<description>&lt;pre&gt; for (int i=0; i&lt;2&gt;  { &lt;/2&gt;&lt;/pre&gt;&lt;br&gt;
should read&lt;br&gt;
&lt;pre&gt;for (int i=0; i&amp;lt;2; i++) { // need to determine col. ct... Columns.Count returns 0&lt;br&gt;
 &lt;/pre&gt;</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.89107-1310142</guid>
  	<pubDate>Thu, 17 Apr 2008 16:47:47 -0800</pubDate>
  	<dc:creator>sanko</dc:creator>
</item>
<item>
  	<title>By: TimeTravelSpeed</title>
  	<link>http://ask.metafilter.com/89107/Custom-header-row-in-NET-datagrid#1310320</link>	
  	<description>Thanks sanko! I&apos;ll try that when I&apos;m back at work.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.89107-1310320</guid>
  	<pubDate>Thu, 17 Apr 2008 19:40:06 -0800</pubDate>
  	<dc:creator>TimeTravelSpeed</dc:creator>
</item>
<item>
  	<title>By: TimeTravelSpeed</title>
  	<link>http://ask.metafilter.com/89107/Custom-header-row-in-NET-datagrid#1314148</link>	
  	<description>Perfect sanko. Worked like a charm. Thank you very much!</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.89107-1314148</guid>
  	<pubDate>Mon, 21 Apr 2008 15:02:08 -0800</pubDate>
  	<dc:creator>TimeTravelSpeed</dc:creator>
</item>

    </channel>
</rss>
