if (e.KeyChar == '\r')
// add your code here
// set the Handled flag to true
e.Handled = true;
you have to set "defaultbutton" in form tag Eg.
<form id="form1" runat="server" defaultbutton="ButtonID">
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)