<?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"
	>
<channel>
	<title>Comments on: Using Panel.DefaultButton property with LinkButton control in ASP.NET</title>
	<atom:link href="http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/</link>
	<description>In my blog I'll try to describe about interesting technologies, my discovery in IT and some useful things about programming.</description>
	<pubDate>Sun, 20 Jul 2008 20:11:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Jared Holgate</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-214432</link>
		<dc:creator>Jared Holgate</dc:creator>
		<pubDate>Mon, 30 Nov 2009 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-214432</guid>
		<description>Mdespesse's point in 17 makes this solution work perfectly in FF3. Thanks.</description>
		<content:encoded><![CDATA[<p>Mdespesse&#8217;s point in 17 makes this solution work perfectly in FF3. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmytro Shteflyuk</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-213961</link>
		<dc:creator>Dmytro Shteflyuk</dc:creator>
		<pubDate>Sat, 30 Nov 2002 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-213961</guid>
		<description>Nice point, mdespesse! Thanks for sharing your experience.</description>
		<content:encoded><![CDATA[<p>Nice point, mdespesse! Thanks for sharing your experience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mdespesse</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-213920</link>
		<dc:creator>mdespesse</dc:creator>
		<pubDate>Thu, 30 Nov 2000 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-213920</guid>
		<description>After some research, it seems that DOM specs stand that href attribute should be an URI and that to get the exact content of href, one should use :

&lt;code lang="javascript"&gt;
eval(b.getAttribute('href'))
&lt;/code&gt;

</description>
		<content:encoded><![CDATA[<p>After some research, it seems that DOM specs stand that href attribute should be an URI and that to get the exact content of href, one should use :</p>
<div class="codecolorer-container javascript" style="height:35px;"><div class="codecolorer" style="font-family: monospace;"><span class="kw1">eval</span><span class="br0">&#40;</span>b.<span class="me1">getAttribute</span><span class="br0">&#40;</span><span class="st0">'href'</span><span class="br0">&#41;</span><span class="br0">&#41;</span></div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: mdespesse</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-213914</link>
		<dc:creator>mdespesse</dc:creator>
		<pubDate>Wed, 30 Nov 2011 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-213914</guid>
		<description>It seems that firefox 3 automatically htmlencode hrefs. So our :

&lt;code lang="javascript"&gt;
javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOption[...]
&lt;/code&gt;

becomes :

&lt;code lang="javascript"&gt;
javascript:WebForm_DoPostBackWithOptions(new%20WebForm_PostBackOption[...]
&lt;/code&gt;

which obviously doesn't work as expected.
To have it work again, change the end of addClickFunctionScript to :

&lt;code lang="javascript"&gt;
eval(unescape(b.href));
&lt;/code&gt;

</description>
		<content:encoded><![CDATA[<p>It seems that firefox 3 automatically htmlencode hrefs. So our :</p>
<div class="codecolorer-container javascript" style="height:35px;"><div class="codecolorer" style="font-family: monospace;">javascript:WebForm_DoPostBackWithOptions<span class="br0">&#40;</span><span class="kw2">new</span> WebForm_PostBackOption<span class="br0">&#91;</span>...<span class="br0">&#93;</span></div></div>
<p>becomes :</p>
<div class="codecolorer-container javascript" style="height:35px;"><div class="codecolorer" style="font-family: monospace;">javascript:WebForm_DoPostBackWithOptions<span class="br0">&#40;</span>new%20WebForm_PostBackOption<span class="br0">&#91;</span>...<span class="br0">&#93;</span></div></div>
<p>which obviously doesn&#8217;t work as expected.<br />
To have it work again, change the end of addClickFunctionScript to :</p>
<div class="codecolorer-container javascript" style="height:35px;"><div class="codecolorer" style="font-family: monospace;"><span class="kw1">eval</span><span class="br0">&#40;</span>unescape<span class="br0">&#40;</span>b.<span class="me1">href</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-212433</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Tue, 30 Nov 2010 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-212433</guid>
		<description>Hi,

I have implemented this fix and it seems to be ok in most cases.  However, if I have a form with asp.net validators then it only works once.  e.g.  Enter an invalid entry, press enter and the correct button is clicked.  However, press enter again, and the wrong one is clicked!

Anyone have any ideas?  Thanks in advance.

Simon.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have implemented this fix and it seems to be ok in most cases.  However, if I have a form with asp.net validators then it only works once.  e.g.  Enter an invalid entry, press enter and the correct button is clicked.  However, press enter again, and the wrong one is clicked!</p>
<p>Anyone have any ideas?  Thanks in advance.</p>
<p>Simon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramana</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-206539</link>
		<dc:creator>Ramana</dc:creator>
		<pubDate>Tue, 30 Nov 2004 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-206539</guid>
		<description>Hi uttam,

i am implemented what you are given the code in my aspx page, but in FireFox again its not working, when i enter key in textbox the cursor goes to next button, could you please give me any idea.

Thanks
Ramana</description>
		<content:encoded><![CDATA[<p>Hi uttam,</p>
<p>i am implemented what you are given the code in my aspx page, but in FireFox again its not working, when i enter key in textbox the cursor goes to next button, could you please give me any idea.</p>
<p>Thanks<br />
Ramana</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-193274</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Fri, 30 Nov 2001 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-193274</guid>
		<description>Solution is ok. Unfortunatelly, this does not work under Firefox 3. 

Anyone know how to do it?</description>
		<content:encoded><![CDATA[<p>Solution is ok. Unfortunatelly, this does not work under Firefox 3. </p>
<p>Anyone know how to do it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jared Holgate</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-192452</link>
		<dc:creator>Jared Holgate</dc:creator>
		<pubDate>Thu, 30 Nov 2000 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-192452</guid>
		<description>This solution worked perfectly. Thank you very much.</description>
		<content:encoded><![CDATA[<p>This solution worked perfectly. Thank you very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: uttam</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-164156</link>
		<dc:creator>uttam</dc:creator>
		<pubDate>Sat, 30 Nov 2002 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-164156</guid>
		<description>reg Above Code--&#62;
Please read this for the reference of the above code , and read the ID's for the textbox's and Link Buttons



for the above code in aspx form ,we have 
a 
asp Text box with id "txtUserName" 
and
a
 link button with id "btnSearch"

like

 

 </description>
		<content:encoded><![CDATA[<p>reg Above Code&#8211;&gt;<br />
Please read this for the reference of the above code , and read the ID&#8217;s for the textbox&#8217;s and Link Buttons</p>
<p>for the above code in aspx form ,we have<br />
a<br />
asp Text box with id &#8220;txtUserName&#8221;<br />
and<br />
a<br />
 link button with id &#8220;btnSearch&#8221;</p>
<p>like</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: uttam</title>
		<link>http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-164153</link>
		<dc:creator>uttam</dc:creator>
		<pubDate>Sat, 30 Nov 2002 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://kpumuk.info/asp-net/using-panel-defaultbutton-property-with-linkbutton-control-in-asp-net/#comment-164153</guid>
		<description>Hi guys i found solution finally.

Setting link button as  Default button for FIREFOX as well as IE:
use this fallowing code--&#62;

in .aspx file---------------------------

[cc lang="javascript"] 
function clickButton(e,buttonid) {
	debugger;
	var bt = document.getElementById(buttonid);
	if (typeof(bt) == 'object') {
		if (navigator.appName.indexOf("Netscape") &gt; -1) {
			if(e.keyCode == 13) {
				if (bt &#038;&#038; typeof(bt.click) == 'undefined') {
					bt.click =  addClickFunction1(bt);
				}
			}
		}
		if (navigator.appName.indexOf("Microsoft Internet Explorer") &gt; -1) {
			if (event.keyCode == 13) {
				bt.click();
				return false;
			}
		}
	}
}

function addClickFunction1(bt) {
	debugger;
	var result = true;
	if (bt.onclick) result = bt.onclick();
	if (typeof(result) == 'undefined' &#124;&#124; result) {
		eval(bt.href);
	}
}
[/cc]

------------------------- 

in aspx.cs file (write code for the text boxes u required) 

aspx.cs file(C#.net code)---&#62;
in Page_Load Event

[cc lang="c#"]
txtUserName.Attributes.Add("onkeypress", "javascript:return clickButton(event,'" + btnSearch.ClientID + "');");
[/cc]

</description>
		<content:encoded><![CDATA[<p>Hi guys i found solution finally.</p>
<p>Setting link button as  Default button for FIREFOX as well as IE:<br />
use this fallowing code&#8211;&gt;</p>
<p>in .aspx file&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<div class="codecolorer-container javascript" style="height:280px;"><div class="codecolorer" style="font-family: monospace;"><span class="kw2">function</span> clickButton<span class="br0">&#40;</span>e,buttonid<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw2">debugger</span>;<br />
&nbsp; &nbsp; <span class="kw2">var</span> bt = document.<span class="me1">getElementById</span><span class="br0">&#40;</span>buttonid<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw1">typeof</span><span class="br0">&#40;</span>bt<span class="br0">&#41;</span> == <span class="st0">'object'</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>navigator.<span class="me1">appName</span>.<span class="me1">indexOf</span><span class="br0">&#40;</span><span class="st0">&quot;Netscape&quot;</span><span class="br0">&#41;</span> &gt; <span class="nu0">-1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>e.<span class="me1">keyCode</span> == <span class="nu0">13</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>bt &amp;&amp; <span class="kw1">typeof</span><span class="br0">&#40;</span>bt.<span class="me1">click</span><span class="br0">&#41;</span> == <span class="st0">'undefined'</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bt.<span class="me1">click</span> =&nbsp; addClickFunction1<span class="br0">&#40;</span>bt<span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>navigator.<span class="me1">appName</span>.<span class="me1">indexOf</span><span class="br0">&#40;</span><span class="st0">&quot;Microsoft Internet Explorer&quot;</span><span class="br0">&#41;</span> &gt; <span class="nu0">-1</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>event.<span class="me1">keyCode</span> == <span class="nu0">13</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bt.<span class="me1">click</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="kw2">function</span> addClickFunction1<span class="br0">&#40;</span>bt<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw2">debugger</span>;<br />
&nbsp; &nbsp; <span class="kw2">var</span> result = <span class="kw2">true</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>bt.<span class="me1">onclick</span><span class="br0">&#41;</span> result = bt.<span class="me1">onclick</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw1">typeof</span><span class="br0">&#40;</span>result<span class="br0">&#41;</span> == <span class="st0">'undefined'</span> || result<span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">eval</span><span class="br0">&#40;</span>bt.<span class="me1">href</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span></div></div>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- </p>
<p>in aspx.cs file (write code for the text boxes u required) </p>
<p>aspx.cs file(C#.net code)&#8212;&gt;<br />
in Page_Load Event</p>
<div class="codecolorer-container c#" style="height:35px;"><div class="codecolorer" style="font-family: monospace;">txtUserName.<span class="me1">Attributes</span>.<span class="me1">Add</span><span class="br0">&#40;</span><span class="st0">&quot;onkeypress&quot;</span>, <span class="st0">&quot;javascript:return clickButton(event,'&quot;</span> + btnSearch.<span class="me1">ClientID</span> + <span class="st0">&quot;');&quot;</span><span class="br0">&#41;</span>;</div></div>
]]></content:encoded>
	</item>
</channel>
</rss>
