<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sides of march &#187; ASP.Net</title>
	<atom:link href="http://www.sidesofmarch.com/index.php/archive/tag/aspnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sidesofmarch.com</link>
	<description>Thoughts on life, liberty, and information technology</description>
	<lastBuildDate>Mon, 16 Jan 2012 02:43:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Looking for a good ASP.Net front-end developer in New York City</title>
		<link>http://www.sidesofmarch.com/index.php/archive/2008/11/17/looking-for-a-good-aspnet-front-end-developer-in-new-york-city/</link>
		<comments>http://www.sidesofmarch.com/index.php/archive/2008/11/17/looking-for-a-good-aspnet-front-end-developer-in-new-york-city/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 20:23:18 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Jobs]]></category>

		<guid isPermaLink="false">http://www.sidesofmarch.com/?p=300</guid>
		<description><![CDATA[<p>A client I&#8217;ve been working with is looking for a front-end ASP.Net developer to work on-site for them in their New York City (midtown) office.</p>
<p>The right candidate should be able to:</p>

develop a complex ASP.Net solution using WebForms;
create web markup (HTML/CSS) from Photoshop mockups;
use <a href="http://www.asp.net/ajax">ASP.Net Ajax</a>, <a href="http://jquery.com">jQuery</a>, or other client-side solutions, and know when to use what;
write efficient front-end code that is tested and works well across a wide range of browsers;
come up with user interface solutions (i.e. help define the client side of the business requirements);
be able to write code-behind and be able to read, understand, and enhance existing business logic code.

<p>If you or someone you know has the right stuff, send <a title="Create an e-mail to 'bdemarzo@gmail.com'" href="mailto:bdemarzo@gmail.com?subject=front-end-aspnet-developer">me an email with your resume</a> and I&#8217;ll pass it along.</p>
<a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a <span style="color:#777"> . . .<br /><br />&#8594; Read More: <a href="http://www.sidesofmarch.com/index.php/archive/2008/11/17/looking-for-a-good-aspnet-front-end-developer-in-new-york-city/">Looking for a good ASP.Net front-end developer in New York City</a></span>]]></description>
			<content:encoded><![CDATA[<p>A client I&#8217;ve been working with is looking for a front-end ASP.Net developer to work on-site for them in their New York City (midtown) office.</p>
<p>The right candidate should be able to:</p>
<ul>
<li>develop a complex ASP.Net solution using WebForms;</li>
<li>create web markup (HTML/CSS) from Photoshop mockups;</li>
<li>use <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.asp.net%2Fajax&sref=rss">ASP.Net Ajax</a>, <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fjquery.com&sref=rss">jQuery</a>, or other client-side solutions, and know when to use what;</li>
<li>write efficient front-end code that is tested and works well across a wide range of browsers;</li>
<li>come up with user interface solutions (i.e. help define the client side of the business requirements);</li>
<li>be able to write code-behind and be able to read, understand, and enhance existing business logic code.</li>
</ul>
<p>If you or someone you know has the right stuff, send <a title="Create an e-mail to 'bdemarzo@gmail.com'" href="mailto:bdemarzo@gmail.com?subject=front-end-aspnet-developer">me an email with your resume</a> and I&#8217;ll pass it along.</p>
<img src="http://www.sidesofmarch.com/?ak_action=api_record_view&id=300&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.sidesofmarch.com/index.php/archive/2008/11/17/looking-for-a-good-aspnet-front-end-developer-in-new-york-city/' addthis:title='Looking for a good ASP.Net front-end developer in New York City ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.sidesofmarch.com/index.php/archive/2008/11/17/looking-for-a-good-aspnet-front-end-developer-in-new-york-city/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cleaning up the GridView&#8217;s EmptyDataTemplate (damn those tables!)</title>
		<link>http://www.sidesofmarch.com/index.php/archive/2008/11/12/cleaning-up-the-gridviews-emptydatatemplate-damn-those-tables/</link>
		<comments>http://www.sidesofmarch.com/index.php/archive/2008/11/12/cleaning-up-the-gridviews-emptydatatemplate-damn-those-tables/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 20:43:43 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[EmptyDataTemplate]]></category>
		<category><![CDATA[GridView]]></category>

		<guid isPermaLink="false">http://www.sidesofmarch.com/?p=298</guid>
		<description><![CDATA[<p>A project I&#8217;ve been working on makes frequent use of the ASP.Net GridView. However, as many people know, the GridView has one glaring issue: It wraps your &#60;EmptyDataTemplate&#62; in an HTML table &#8212; something that I don&#8217;t want, for two reasons:</p>

My empty data template does not consist of tabular data.
My stylesheet has a default style for tables &#8212; a style that I don&#8217;t want applied to my empty data template.

<p>One solution is to use the <a title="CSSFriendly project on CodePlex" href="http://www.codeplex.com/cssfriendly">CSS Friendly Adapters for ASP.Net</a>, which potentially solves both prolems, but that will bring in potential breaking changes to my GridView controls. I don&#8217;t have time for that (yet).</p>
<p>The solution I came up with is to do two things:</p>

Create a new CSS class that removes table formatting (borders, backgrounds, padding, margins, etc.). This class will be applied to the GridView only when it has no data.
Add a line of code in the OnPreRender() method for each web page or control that <span style="color:#777"> . . .<br /><br />&#8594; Read More: <a href="http://www.sidesofmarch.com/index.php/archive/2008/11/12/cleaning-up-the-gridviews-emptydatatemplate-damn-those-tables/">Cleaning up the GridView&#8217;s EmptyDataTemplate (damn those tables!)</a></span>]]></description>
			<content:encoded><![CDATA[<p>A project I&#8217;ve been working on makes frequent use of the ASP.Net GridView. However, as many people know, the GridView has one glaring issue: It wraps your <code>&lt;EmptyDataTemplate&gt;</code> in an HTML table &#8212; something that I don&#8217;t want, for two reasons:</p>
<ol>
<li>My empty data template does not consist of tabular data.</li>
<li>My stylesheet has a default style for tables &#8212; a style that I don&#8217;t want applied to my empty data template.</li>
</ol>
<p>One solution is to use the <a title="CSSFriendly project on CodePlex" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.codeplex.com%2Fcssfriendly&sref=rss">CSS Friendly Adapters for ASP.Net</a>, which potentially solves both prolems, but that will bring in potential breaking changes to my GridView controls. I don&#8217;t have time for that (yet).</p>
<p>The solution I came up with is to do two things:</p>
<ol>
<li>Create a new CSS class that removes table formatting (borders, backgrounds, padding, margins, etc.). This class will be applied to the GridView only when it has no data.</li>
<li>Add a line of code in the<code> OnPreRender()</code> method for each web page or control that has a GridView, conditionally setting the CSS class of the GridView to the aforementioned class.</li>
</ol>
<p>My CSS class looks like the following.</p>
<pre class="brush: css; ">

.empty, .empty td { border:0;background:none;margin:0;padding:0; }
</pre>
<p>The line of code in your <code>OnPreRender()</code> event follows.</p>
<pre class="brush: c-sharp; ">

protected override void OnPreRender(EventArgs e)
{
    base.OnPreRender(e);

    if (myGridView.Rows.Count == 0)
        myGridView.CssClass = &quot;empty&quot;;
}
</pre>
<p>Why the OnPreRender stage? By placing your code here, you ensure that all data loaded into your GridView is already bound, whether it be from code (<code>myGridView.DataBind()</code>), from data sources in markup (such as the <code>ObjectDataSource</code>), or from viewstate.</p>
<p>It isn&#8217;t pretty, and it doesn&#8217;t give you <a title="Semantic Markup and Accessibility Standards - An overview | New Age Design" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.new-age-design.com%2Fbusiness%2Fsemantic-markup-and-accessibility-standards-an-overview&sref=rss">semantic markup</a>, but it&#8217;s easy enough to implement and can solve the visual problem.</p>
<img src="http://www.sidesofmarch.com/?ak_action=api_record_view&id=298&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.sidesofmarch.com/index.php/archive/2008/11/12/cleaning-up-the-gridviews-emptydatatemplate-damn-those-tables/' addthis:title='Cleaning up the GridView&#8217;s EmptyDataTemplate (damn those tables!) ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.sidesofmarch.com/index.php/archive/2008/11/12/cleaning-up-the-gridviews-emptydatatemplate-damn-those-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rewriting the ASP.Net CSS Friendly Adapters &#8211; does anyone care?</title>
		<link>http://www.sidesofmarch.com/index.php/archive/2008/09/23/rewriting-the-aspnet-css-friendly-adapters-does-anyone-care/</link>
		<comments>http://www.sidesofmarch.com/index.php/archive/2008/09/23/rewriting-the-aspnet-css-friendly-adapters-does-anyone-care/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 12:33:40 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[CSSFriendly]]></category>

		<guid isPermaLink="false">http://www.sidesofmarch.com/?p=284</guid>
		<description><![CDATA[<p>A few days ago, I wrote a <a href="http://forums.asp.net/t/1321134.aspx">lengthy post on the official ASP.Net forums</a> where I discussed some thoughts on a new version of the <a href="http://www.codeplex.com/cssfriendly">CSS-friendly ASP.Net control adapters</a>. In the post, I outlined some new approaches to improve testability and configuration.</p>
<p>Since that post (written on the evening of Sept 16), there have been no replies, which leads me to consider a few possible realities&#8230;</p>

No one reads the ASP.Net forums. (Not true; the post was read at least 79 times, as of this writing.)
No one posts on the ASP.Net forums.  (Not true; other posts were written since my post.)
No one uses the CSS Friendly adapters. (Not true; they have been downloaded over 1,800 times in the last week, according to CodePlex &#8212; making it the 14th most popular CodePlex project in that time.)
No one cares about rewriting them.
No one who cares about rewriting them reads the ASP.Net forums.

<p>OK, so either no one cares about improving on what we currently <span style="color:#777"> . . .<br /><br />&#8594; Read More: <a href="http://www.sidesofmarch.com/index.php/archive/2008/09/23/rewriting-the-aspnet-css-friendly-adapters-does-anyone-care/">Rewriting the ASP.Net CSS Friendly Adapters &#8211; does anyone care?</a></span>]]></description>
			<content:encoded><![CDATA[<p>A few days ago, I wrote a <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fforums.asp.net%2Ft%2F1321134.aspx&sref=rss">lengthy post on the official ASP.Net forums</a> where I discussed some thoughts on a new version of the <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.codeplex.com%2Fcssfriendly&sref=rss">CSS-friendly ASP.Net control adapters</a>. In the post, I outlined some new approaches to improve testability and configuration.</p>
<p>Since that post (written on the evening of Sept 16), there have been no replies, which leads me to consider a few possible realities&#8230;</p>
<ol>
<li>No one reads the ASP.Net forums. (Not true; the post was read at least 79 times, as of this writing.)</li>
<li>No one posts on the ASP.Net forums.  (Not true; other posts were written since my post.)</li>
<li>No one uses the CSS Friendly adapters. (Not true; they have been downloaded over 1,800 times in the last week, according to CodePlex &#8212; making it the 14th most popular CodePlex project in that time.)</li>
<li>No one cares about rewriting them.</li>
<li>No one who cares about rewriting them reads the ASP.Net forums.</li>
</ol>
<p>OK, so either no one cares about improving on what we currently have, or no one who cares saw my post. Which is it? Do you use the CSS adapters? <em>Would</em> you use them if they were improved?</p>
<img src="http://www.sidesofmarch.com/?ak_action=api_record_view&id=284&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.sidesofmarch.com/index.php/archive/2008/09/23/rewriting-the-aspnet-css-friendly-adapters-does-anyone-care/' addthis:title='Rewriting the ASP.Net CSS Friendly Adapters &#8211; does anyone care? ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.sidesofmarch.com/index.php/archive/2008/09/23/rewriting-the-aspnet-css-friendly-adapters-does-anyone-care/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Remove anonymous users from ASP.Net Membership tables</title>
		<link>http://www.sidesofmarch.com/index.php/archive/2008/08/07/remove-anonymous-users-from-aspnet-membership-tables/</link>
		<comments>http://www.sidesofmarch.com/index.php/archive/2008/08/07/remove-anonymous-users-from-aspnet-membership-tables/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 18:53:47 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.sidesofmarch.com/?p=269</guid>
		<description><![CDATA[<p>If you use the <a href="http://weblogs.asp.net/scottgu/archive/2006/02/24/ASP.NET-2.0-Membership_2C00_-Roles_2C00_-Forms-Authentication_2C00_-and-Security-Resources-.aspx">ASP.Net membership tools</a>, have &#60;anonymousIdentification enabled="true" /&#62; specified in your Web.config, and get lots of anonymous visitors, it&#8217;s only a matter of time before your database grows. What&#8217;s filling it up is the countless user records for your anonymous users.</p>
<p>If you don&#8217;t need to track user and profile information for an anonymous user once they leave the site, you can delete the unneeded data by running a SQL script. The following script will delete from your membership tables all anonymous users whose last activity was more than 7 days ago.</p>


delete from aspnet_profile
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) &#38;gt; 7
)

delete from aspnet_usersinroles
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) &#38;gt; 7
)

delete from aspnet_membership
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) &#38;gt; 7
)

delete from aspnet_personalizationperuser
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) <span style="color:#777"> . . .<br /><br />&#8594; Read More: <a href="http://www.sidesofmarch.com/index.php/archive/2008/08/07/remove-anonymous-users-from-aspnet-membership-tables/">Remove anonymous users from ASP.Net Membership tables</a></span>]]></description>
			<content:encoded><![CDATA[<p>If you use the <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fweblogs.asp.net%2Fscottgu%2Farchive%2F2006%2F02%2F24%2FASP.NET-2.0-Membership_2C00_-Roles_2C00_-Forms-Authentication_2C00_-and-Security-Resources-.aspx&sref=rss">ASP.Net membership tools</a>, have <code>&lt;anonymousIdentification enabled="true" /&gt;</code> specified in your Web.config, and get lots of anonymous visitors, it&#8217;s only a matter of time before your database grows. What&#8217;s filling it up is the countless user records for your anonymous users.</p>
<p>If you don&#8217;t need to track user and profile information for an anonymous user once they leave the site, you can delete the unneeded data by running a SQL script. The following script will delete from your membership tables all anonymous users whose last activity was more than 7 days ago.</p>
<pre class="brush: sql; ">

delete from aspnet_profile
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) &amp;gt; 7
)

delete from aspnet_usersinroles
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) &amp;gt; 7
)

delete from aspnet_membership
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) &amp;gt; 7
)

delete from aspnet_personalizationperuser
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) &amp;gt; 7
)

delete from aspnet_users
where userid in ( select userid from aspnet_users
where isanonymous = 1
and datediff(dd, lastactivitydate, getdate()) &amp;gt; 7
)
</pre>
<p>Doing this may be very important to those using a shared hosting plan that has limited SQL disk space, as those anonymous users can quickly eat up disk space. Since each row in aspnet_users takes up just over 1kb, having 1,000 anonymous users will eat up 1MB &#8212; something that adds up quick if you only have 250MB of SQL disk storage.</p>
<img src="http://www.sidesofmarch.com/?ak_action=api_record_view&id=269&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.sidesofmarch.com/index.php/archive/2008/08/07/remove-anonymous-users-from-aspnet-membership-tables/' addthis:title='Remove anonymous users from ASP.Net Membership tables ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.sidesofmarch.com/index.php/archive/2008/08/07/remove-anonymous-users-from-aspnet-membership-tables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Firefox, LinkButtons, and the Panel.DefaultButton: a (Prototype) fix</title>
		<link>http://www.sidesofmarch.com/index.php/archive/2007/11/08/firefox-linkbuttons-and-the-paneldefaultbutton-a-prototype-fix/</link>
		<comments>http://www.sidesofmarch.com/index.php/archive/2007/11/08/firefox-linkbuttons-and-the-paneldefaultbutton-a-prototype-fix/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 16:32:17 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Prototype]]></category>

		<guid isPermaLink="false">http://www.sidesofmarch.com/index.php/archive/2007/11/08/firefox-linkbuttons-and-the-paneldefaultbutton-a-prototype-fix/</guid>
		<description><![CDATA[<p>Recently I&#8217;ve stepped away from the <a href="http://www.castleproject.org/monorail">MonoRail</a> world to work on a project that uses ASP.Net WebForms. It didn&#8217;t take long before I found an annoying problem. (Actually I found many annoying problems, but I&#8217;ll focus on one here.)</p>
<p>The &#60;ASP:Panel&#62; control has a DefaultButton property which, according to the documentation, &#34;Gets or sets the identifier for the default button that is contained in the Panel control.&#34; In other words:</p>
<blockquote>
<p>Use the DefaultButton property to indicate which button gets clicked when the Panel control has focus and the user presses the ENTER key.</p>
</blockquote>
<p>It works perfectly, if you&#8217;re not using a LinkButton control. Actually, that&#8217;s not true; if you use a LinkButton control and Internet Explorer, it works fine. It just doesn&#8217;t work in Firefox. Why?</p>
<p><a href="http://kpumuk.info/">Dmytro Shteflyuk</a> outlines why in his blog post, <em><a href="http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/">Using Panel.DefaultButton property with LinkButton control in ASP.Net</a></em>. Apparently, it&#8217;s an issue with the JavaScript code that Microsoft generates, which expects a click() method on the anchor (i.e. <span style="color:#777"> . . .<br /><br />&#8594; Read More: <a href="http://www.sidesofmarch.com/index.php/archive/2007/11/08/firefox-linkbuttons-and-the-paneldefaultbutton-a-prototype-fix/">Firefox, LinkButtons, and the Panel.DefaultButton: a (Prototype) fix</a></span>]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve stepped away from the <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.castleproject.org%2Fmonorail&sref=rss">MonoRail</a> world to work on a project that uses ASP.Net WebForms. It didn&#8217;t take long before I found an annoying problem. (Actually I found many annoying problems, but I&#8217;ll focus on one here.)</p>
<p>The &lt;ASP:Panel&gt; control has a <code>DefaultButton</code> property which, according to the documentation, &quot;Gets or sets the identifier for the default button that is contained in the <code>Panel</code> control.&quot; In other words:</p>
<blockquote>
<p>Use the <b>DefaultButton</b> property to indicate which button gets clicked when the <b>Panel</b> control has focus and the user presses the ENTER key.</p>
</blockquote>
<p>It works perfectly, if you&#8217;re not using a <code>LinkButton</code> control. Actually, that&#8217;s not true; if you use a <code>LinkButton</code> control and Internet Explorer, it works fine. It just doesn&#8217;t work in Firefox. Why?</p>
<p><a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fkpumuk.info%2F&sref=rss">Dmytro Shteflyuk</a> outlines why in his blog post, <em><a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fkpumuk.info%2Fasp-net%2Fusing-panel-defaultbutton-property-with-linkbutton-control-in-asp-net%2F&sref=rss">Using Panel.DefaultButton property with LinkButton control in ASP.Net</a></em>. Apparently, it&#8217;s an issue with the JavaScript code that Microsoft generates, which expects a <code>click()</code> method on the anchor (i.e. <code>LinkButton</code>). Firefox doesn&#8217;t have such an event for anchors &#8212; at least, not by default.</p>
<p>Dmytro outlines a fix which requires you to injext some JavaScript for each button. I prefer a simpler approach using CSS selectors, so I wrote the following script (Prototype required) to do it. Simply add this script to your web page, add the CSS class &quot;button&quot; to each LinkButton control, and press ENTER on your Firefox forms.</p>
<pre class="brush: c-sharp; ">

function prepareLinkButtonClicks()
{
	$$(&#039;a.button&#039;).each(function(tag) {
		if (tag &amp;&amp; typeof(tag.click == &#039;undefined&#039;)) {
			tag.click = function() {
				var result = true;
				if (tag.onclick) result = tag.onclick();
				if (typeof(result) == &#039;undefined&#039; || result) {
					eval(tag.href);
				}
			}
		}
	});
}
Event.observe(window, &#039;load&#039;, prepareLinkButtonClicks);
</pre>
<img src="http://www.sidesofmarch.com/?ak_action=api_record_view&id=179&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.sidesofmarch.com/index.php/archive/2007/11/08/firefox-linkbuttons-and-the-paneldefaultbutton-a-prototype-fix/' addthis:title='Firefox, LinkButtons, and the Panel.DefaultButton: a (Prototype) fix ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.sidesofmarch.com/index.php/archive/2007/11/08/firefox-linkbuttons-and-the-paneldefaultbutton-a-prototype-fix/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A simple asp:Repeater replacement for simple needs</title>
		<link>http://www.sidesofmarch.com/index.php/archive/2007/10/28/a-simple-asprepeater-replacement-for-simple-needs/</link>
		<comments>http://www.sidesofmarch.com/index.php/archive/2007/10/28/a-simple-asprepeater-replacement-for-simple-needs/#comments</comments>
		<pubDate>Sun, 28 Oct 2007 12:49:44 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[C#/.Net]]></category>

		<guid isPermaLink="false">http://www.sidesofmarch.com/index.php/archive/2007/10/28/a-simple-asprepeater-replacement-for-simple-needs/</guid>
		<description><![CDATA[<p>How many times have you had to parse through a collection of objects, outputting nothing more than a comma-delimited list of items in the result set. Typically, you&#8217;ll do this:</p>


&#60;asp :repeater runat=&#34;server&#34;&#62;
	&#60;itemtemplate&#62;Eval(&#34;Name&#34;)&#60;/itemtemplate&#62;
	&#60;separatortemplate&#62;, &#60;/separatortemplate&#62;
&#60;/asp&#62;

<p>If you were parsing a list of states, it might look like this:</p>
<blockquote><p>Alabama, Alaska, Arizona, Arkansas</p></blockquote>
<p>There&#8217;s an easier way to handle these simple needs: create a CollectionToString() method. This method would accept an IEnumerable and, using reflection, read a property and return a delimited string. Of course, you choose the property and delimiter.</p>
<p>Note that we have two versions of this method: one which accepts an IEnumerable, the other which accepts an object. This is done to avoid the necessary typecasting in your code, since Eval() returns everything as an object.</p>


public static string CollectionToString(IEnumerable collection, string property, string delimiter)
{
	IEnumerator enumerator = collection.GetEnumerator();
	if (enumerator == null &#124;&#124; enumerator.MoveNext() == false)
		return String.Empty;

	Type type = enumerator.Current.GetType();
	PropertyInfo propInfo = type.GetProperty(property);
	if (propInfo == null)
		throw new Exception(String.Format(&#34;Property &#039;{0}&#039; not found in collection&#34;, property));

	StringBuilder output = new <span style="color:#777"> . . .<br /><br />&#8594; Read More: <a href="http://www.sidesofmarch.com/index.php/archive/2007/10/28/a-simple-asprepeater-replacement-for-simple-needs/">A simple asp:Repeater replacement for simple needs</a></span>]]></description>
			<content:encoded><![CDATA[<p>How many times have you had to parse through a collection of objects, outputting nothing more than a comma-delimited list of items in the result set. Typically, you&#8217;ll do this:</p>
<pre class="brush: html; ">

&lt;asp :repeater runat=&quot;server&quot;&gt;
	&lt;itemtemplate&gt;Eval(&quot;Name&quot;)&lt;/itemtemplate&gt;
	&lt;separatortemplate&gt;, &lt;/separatortemplate&gt;
&lt;/asp&gt;
</pre>
<p>If you were parsing a list of states, it might look like this:</p>
<blockquote><p>Alabama, Alaska, Arizona, Arkansas</p></blockquote>
<p>There&#8217;s an easier way to handle these simple needs: create a <code>CollectionToString()</code> method. This method would accept an <code>IEnumerable</code> and, using reflection, read a property and return a delimited string. Of course, you choose the property and delimiter.</p>
<p>Note that we have two versions of this method: one which accepts an <code>IEnumerable</code>, the other which accepts an object. This is done to avoid the necessary typecasting in your code, since <code>Eval()</code> returns everything as an <code>object</code>.</p>
<pre class="brush: c-sharp; ">

public static string CollectionToString(IEnumerable collection, string property, string delimiter)
{
	IEnumerator enumerator = collection.GetEnumerator();
	if (enumerator == null || enumerator.MoveNext() == false)
		return String.Empty;

	Type type = enumerator.Current.GetType();
	PropertyInfo propInfo = type.GetProperty(property);
	if (propInfo == null)
		throw new Exception(String.Format(&quot;Property &#039;{0}&#039; not found in collection&quot;, property));

	StringBuilder output = new StringBuilder();
	output.Append(propInfo.GetValue(enumerator.Current, null).ToString());

	while (enumerator.MoveNext())
	{
		output.Append(delimiter);
		output.Append(propInfo.GetValue(enumerator.Current, null).ToString());
	}

	return output.ToString();
}

public static string CollectionToString(object collection, string property, string delimiter)
{
	return CollectionToString(collection as IEnumerable, property, delimiter);
}
</pre>
<p>This method &#8212; which I typically apply to a <code>StringHelper</code> class whose namespace is added to my web.config (more on that another day) &#8212; can replace the Repeater code above as follows.</p>
<pre class="brush: html; ">

&lt;!-- you must first expose the collection to the ASPX page as a public property --&gt;
&lt; %= StringHelper.CollectionToString(&quot;ListOfStates&quot;, &quot;Name&quot;, &quot;, &quot;) %&gt;
</pre>
<p>A similar method could be added to a helper class in <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.castleproject.org%2Fmonorail&sref=rss">Castle MonoRail</a> to do the same without using <code>foreach</code> loops in your view.</p>
<img src="http://www.sidesofmarch.com/?ak_action=api_record_view&id=177&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.sidesofmarch.com/index.php/archive/2007/10/28/a-simple-asprepeater-replacement-for-simple-needs/' addthis:title='A simple asp:Repeater replacement for simple needs ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.sidesofmarch.com/index.php/archive/2007/10/28/a-simple-asprepeater-replacement-for-simple-needs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

