Aspx default acceptbutton

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey,

How can I set the defaut accept button in an aspx-page.

In some screens I see in acceptbutton but I see know difference between this
button properties and the others.

Thanks Jac
 
Hi Jac,

There are two ways to go about this.

Option 1: Write inline HTML code to set a button as the default. Here
is a sample....

<script language='javascript'>
function run()
{
alert('hello');
}
</script>
<BODY onLoad="document.all('btnDone').focus();">
This is a sample line. <BR>
This is another sample line. <BR><BR>
<INPUT id='btnDone' type='button' value='Done' onClick='run();'>
</BODY>

Option 2: You can do the same.... but from the code-behind file, which
will generate an equivalent HTML file. You can use
RegisterClientScriptBlock statement to generate client-side script from the
code-behind file.

HTH,
-Azhagan
 
Back
Top