How can I set default button after text is entered into a text box. This is what I have so far. But it doesn't work
<td>
<asp:Label ID="displayrowLabel" runat="server" Text="# of Rows Displayed:"></asp:Label>
<asp:TextBox ID="displayRowQuery" runat="server"></asp:TextBox>
<asp:Button ID="displayRowButton" runat="server" Text="Click" OnClick="ddlPageItems_SelectedIndexChanged" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="displayRowQuery" ValidationExpression="[1-9][0-9]*" ErrorMessage="Wrong Input" />
</td>
</tr>
</table>
</PagerTemplate>
I tried adding some jquery to handle this:
<script type="text/javascript">
$("displayRowQuery").keyup(function (event) {
if (event.keyCode == 13) {
$("displayRowButton").click();
}
});
`$("#displayRowButton") >= $("#<% = displayRowButton.ClientId %>")` – Nicolás Aug 09 '11 at 00:04