<?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>dotnet thoughts &#187; BackToBasics</title>
	<atom:link href="http://www.dotnetthoughts.net/tag/backtobasics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotnetthoughts.net</link>
	<description>a dotnet developer&#039;s technical blog</description>
	<lastBuildDate>Wed, 08 Feb 2012 03:18:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ASP.Net Default button and Master Pages</title>
		<link>http://www.dotnetthoughts.net/2010/06/21/asp-net-default-button-and-master-pages/</link>
		<comments>http://www.dotnetthoughts.net/2010/06/21/asp-net-default-button-and-master-pages/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 07:33:34 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[BackToBasics]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.dotnetthoughts.net/?p=908</guid>
		<description><![CDATA[Last few days I was(am) busy with one pure ASP.Net application(why its pure because we are not using any 3rd party controls, ajax nothing. Everything is postbacking ). Today I got a weird bug from one of my QC team &#8230; <a href="http://www.dotnetthoughts.net/2010/06/21/asp-net-default-button-and-master-pages/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last few days I was(am) busy with one pure ASP.Net application(why its pure because we are not using any 3rd party controls, ajax nothing. Everything is postbacking <img src='http://www.dotnetthoughts.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ). Today I got a weird bug from one of my QC team saying when ever they presses ENTER button, focus is on any textbox, it popups Help window from our application. In our application, end users can open the Help window, by clicking on some help images icons provided in the application. These images are displayed using ASP Image button controls (If you are using ASP Image controls this problem will not occur, but in our application, we need to disable it some scenarios, so can&#8217;t use ASP Image). After searching I found the issue with the default button property of ASP.Net, which helps us to submit the form using Enter Key. In my page ASP.Net considering the Help image button as default button for the Page. We can set the default button to our submit button using various methods. Set the default button property of the FORM, or create a Panel control over the controls and set the default button property of the Panel.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form id=&quot;form1&quot; runat=&quot;server&quot; defaultbutton=&quot;cmdSubmit&quot;&gt;
&lt;asp:Panel runat=&quot;server&quot; ID=&quot;plMain&quot; DefaultButton=&quot;cmdSubmit&quot;&gt;
</pre>
<p>Form tag also supports  &#8220;defaultfocus&#8221; this property allows to focus to control, on Page Load.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form id=&quot;form1&quot; runat=&quot;server&quot; defaultbutton=&quot;cmdSubmit&quot; defaultfocus=&quot;txtUser&quot;&gt;
</pre>
<p>If you are using Master Pages, there will be some slight difference because, the Form tag will not be available in the content Pages. It can fix using code behind, using FindControl method.</p>
<pre class="brush: csharp; title: ; notranslate">
(Page.Master.FindControl(&quot;Form1&quot;) as HtmlForm).DefaultButton = this.cmdSubmit.UniqueID;
</pre>
<p>Also you can do something like this</p>
<pre class="brush: csharp; title: ; notranslate">
Page.Master.Page.Form.DefaultButton = cmdSubmit.UniqueID;
</pre>
<p>Happy Coding <img src='http://www.dotnetthoughts.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="betterrelated"><p><strong>Related content:</strong></p>
<ol><li> <a href="http://www.dotnetthoughts.net/2009/10/07/how-to-store-and-retrieve-files-from-sql-server-database/" title="Permanent link to How to Store and Retrieve files from SQL Server Database">How to Store and Retrieve files from SQL Server Database</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2010/03/30/using-custom-controls-from-app_code-folder/" title="Permanent link to Using custom controls from App_Code folder">Using custom controls from App_Code folder</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2008/10/08/control-focus-with-postback/" title="Permanent link to Control focus with Postback">Control focus with Postback</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2011/11/15/how-to-persist-checkbox-state-in-gridview-while-paging/" title="Permanent link to How to persist checkbox state in gridview while paging">How to persist checkbox state in gridview while paging</a>  </li>
<li> <a href="http://www.dotnetthoughts.net/2009/09/11/a-simple-chat-script-using-asp-net-c/" title="Permanent link to A Simple Chat script using ASP.Net C#">A Simple Chat script using ASP.Net C#</a>  </li>
</ol></div>]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2010/06/21/asp-net-default-button-and-master-pages/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

