Submit details with enter key
-
I have a user control with some textboxes and linkbuttons, when I write some text in one of the textboxes and then hit the enter key, the page load event fires. is it possible to cause one of the other page's events to fire?
-
I have a user control with some textboxes and linkbuttons, when I write some text in one of the textboxes and then hit the enter key, the page load event fires. is it possible to cause one of the other page's events to fire?
hi benams, What i have understood, the solution is "javascript" check for e.keycode (or e.which) and compare it with 13 the ascii value for enter key then u can call method
__doPostBack("control_name","event_to_call")
this will cause the postback to the spcified event in the code behind file. Check out if this helps regards -
hi benams, What i have understood, the solution is "javascript" check for e.keycode (or e.which) and compare it with 13 the ascii value for enter key then u can call method
__doPostBack("control_name","event_to_call")
this will cause the postback to the spcified event in the code behind file. Check out if this helps regards -
I tryed __doPostBack("lnb","Click") and __doPostBack("lnb","OnClick"). Both of them cause postback, but non of them fires the Click event of the wanted contorl...
hey benams, So according to ur present senario, i guess one of the following 2 will help 1. In case the control use server side event u wanna fire is an html control with
runat="server"
tag, in that case u need to use javascript in the following manner<script language=javascript type=text/javascript>
function checkKey()
{
var key;
key = window.event.keyCode;
if(key==13)
{
var btn = document.getElementById("Control_ID");
if(btn!=null)
{
btn.focus();
btn.ServerClick();
}
}
}
</script>- In case the control is an asp control starting with
**asp:**
then in that case the earlier way i suggested is appropriate, further follow this link to clear ur doubts Hope this helps, and if not feel free to query again Till then happy coding ;)
- In case the control is an asp control starting with