<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: CheckBoxList as an HTML Unordered List with Subheadings</title>
	<atom:link href="http://rightbrainleft.net/2009/09/checkboxlist-as-an-html-unordered-list-with-subheadings/feed/" rel="self" type="application/rss+xml" />
	<link>http://rightbrainleft.net/2009/09/checkboxlist-as-an-html-unordered-list-with-subheadings/</link>
	<description>C# and Game Development</description>
	<lastBuildDate>Thu, 16 Dec 2010 18:35:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Simen</title>
		<link>http://rightbrainleft.net/2009/09/checkboxlist-as-an-html-unordered-list-with-subheadings/comment-page-1/#comment-65</link>
		<dc:creator>Simen</dc:creator>
		<pubDate>Wed, 16 Dec 2009 12:32:47 +0000</pubDate>
		<guid isPermaLink="false">http://rightbrainleft.net/?p=80#comment-65</guid>
		<description>Thanks for this. It helped me out :) I read that in ASP.NET 4 unordered list will be available from the base control. Until then this is excelent.</description>
		<content:encoded><![CDATA[<p>Thanks for this. It helped me out :) I read that in ASP.NET 4 unordered list will be available from the base control. Until then this is excelent.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wayne Denier</title>
		<link>http://rightbrainleft.net/2009/09/checkboxlist-as-an-html-unordered-list-with-subheadings/comment-page-1/#comment-64</link>
		<dc:creator>Wayne Denier</dc:creator>
		<pubDate>Tue, 01 Dec 2009 21:04:20 +0000</pubDate>
		<guid isPermaLink="false">http://rightbrainleft.net/?p=80#comment-64</guid>
		<description>Sure thing. In the Page_Load method of the code behind for my .aspx page, i put in a line to bind the ItemPreRender event of my control to a method.

[csharp]
// Bind event for ListItem PreRender, so we can add the Organization headings in the middle
                cblInvestigators.ItemPreRender += CheckBox_ItemPreRender;
[/csharp]

Then I created the method CheckBox_ItemPreRender in the codebehind as well. This is a pretty sloppy version, but I&#039;m handing the event the original list of data being bound, as well as the current index and list item being operated on. The HtmlTextWriter is what you&#039;ll use to create output (kind of like Response.Write for classic ASP).

[csharp]
protected void CheckBox_ItemPreRender(System.Collections.IEnumerable data, int index, ListItem item, System.Web.UI.HtmlTextWriter writer)
        {
            // Get the item that was databound to the checkbox
            Model.Profile profile = data.Cast().ElementAt(index);
            
            // if this is the first item belonging to this org, show the header
            if (previousOrgId != profile.Org.Id)
                writer.Write(&quot;my header text that is different from the last row!&quot;);

            // store the orgId to compare against the next item
            previousOrgId = profile.Org.Id;
        }
[/csharp]

Sorry if this does not format the code correctly in the comments, you may need to just cut and paste :)</description>
		<content:encoded><![CDATA[<p>Sure thing. In the Page_Load method of the code behind for my .aspx page, i put in a line to bind the ItemPreRender event of my control to a method.</p>
<pre class="brush: csharp;">
// Bind event for ListItem PreRender, so we can add the Organization headings in the middle
                cblInvestigators.ItemPreRender += CheckBox_ItemPreRender;
</pre>
<p>Then I created the method CheckBox_ItemPreRender in the codebehind as well. This is a pretty sloppy version, but I&#8217;m handing the event the original list of data being bound, as well as the current index and list item being operated on. The HtmlTextWriter is what you&#8217;ll use to create output (kind of like Response.Write for classic ASP).</p>
<pre class="brush: csharp;">
protected void CheckBox_ItemPreRender(System.Collections.IEnumerable data, int index, ListItem item, System.Web.UI.HtmlTextWriter writer)
        {
            // Get the item that was databound to the checkbox
            Model.Profile profile = data.Cast().ElementAt(index);

            // if this is the first item belonging to this org, show the header
            if (previousOrgId != profile.Org.Id)
                writer.Write("my header text that is different from the last row!");

            // store the orgId to compare against the next item
            previousOrgId = profile.Org.Id;
        }
</pre>
<p>Sorry if this does not format the code correctly in the comments, you may need to just cut and paste :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan V</title>
		<link>http://rightbrainleft.net/2009/09/checkboxlist-as-an-html-unordered-list-with-subheadings/comment-page-1/#comment-63</link>
		<dc:creator>Ryan V</dc:creator>
		<pubDate>Tue, 01 Dec 2009 14:35:14 +0000</pubDate>
		<guid isPermaLink="false">http://rightbrainleft.net/?p=80#comment-63</guid>
		<description>I realize this may be outside the scope of this article, but could you share your implementation of the following:

&quot;... On the page using the control, I hooked a method up to the Event that checked to see if the ‘Category’ was different than the last item&quot;</description>
		<content:encoded><![CDATA[<p>I realize this may be outside the scope of this article, but could you share your implementation of the following:</p>
<p>&#8220;&#8230; On the page using the control, I hooked a method up to the Event that checked to see if the ‘Category’ was different than the last item&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

