{"id":24,"date":"2013-09-11T02:14:57","date_gmt":"2013-09-11T02:14:57","guid":{"rendered":"http:\/\/passionwind.com\/techref\/?p=24"},"modified":"2013-09-11T12:38:50","modified_gmt":"2013-09-11T12:38:50","slug":"set-default-enter-button-in-asp-net","status":"publish","type":"post","link":"http:\/\/techref.camellarry.com\/?p=24","title":{"rendered":"Set Default Enter Button in ASP.NET"},"content":{"rendered":"<p>I recently had to define a default Enter button on an ASP.NET page but could not use the Form field because it was inherited from a master page. \u00a0I eventually discovered that this can be done by defining the button in a panel as shown below.<\/p>\n<p><span style=\"color: #333399;\">&lt;asp:Panel runat=&#8221;server&#8221; DefaultButton=&#8221;btnSearch&#8221;&gt;<\/span><br \/>\n<span style=\"color: #333399;\">..<\/span><br \/>\n<span style=\"color: #333399;\"><em>&lt;asp:Button ID=&#8221;btnSearch&#8221; runat=&#8221;server&#8221; Text=&#8221;Search&#8221; \/&gt;<br \/>\n<\/em><em id=\"__mceDel\"><em id=\"__mceDel\"><em id=\"__mceDel\">..<br \/>\n<em id=\"__mceDel\"><em id=\"__mceDel\"><em id=\"__mceDel\">&lt;\/asp:Panel&gt;<\/em><\/em><\/em><\/em><\/em><\/em><\/span><\/p>\n<p>Use \u00a0<em>txtSearch.Focus()<\/em>\u00a0to set focus on the default field (in this case txtSearch).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently had to define a default Enter button on an ASP.NET page but could not use the Form field because it was inherited from a master page. \u00a0I eventually discovered that this can be done by defining the button in a panel as shown below. &lt;asp:Panel runat=&#8221;server&#8221; DefaultButton=&#8221;btnSearch&#8221;&gt; .. &lt;asp:Button ID=&#8221;btnSearch&#8221; runat=&#8221;server&#8221; Text=&#8221;Search&#8221; \/&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2],"tags":[16,18,28,58,74,76,77,78],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-asp-net","tag-asp-net","tag-button","tag-default","tag-programming","tag-tutorial","tag-vb","tag-vb-net","tag-visualbasic"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9t3oE-o","_links":{"self":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24"}],"version-history":[{"count":2,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":248,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/24\/revisions\/248"}],"wp:attachment":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}