Instead of default button click on page load, we can call any other particular button click
In design page:
<script language="javascript" type="text/javascript">
function clickButton(e, buttonid){
var evt = e ? e : window.event;
var bt = document.getElementById(
buttonid);
if (bt){
if (evt.keyCode == 13){
bt.click();
return false;
}
}
}
</script>
in Code behind:
if (!IsPostBack)
{
Textsearch.Attributes.Add(" onkeypress", "return clickButton(event,'" + Btnsearch.ClientID + "')");
}
Here after any keypress in the text seach box it will take to the search button click instead of default button
In design page:
<script language="javascript" type="text/javascript">
function clickButton(e, buttonid){
var evt = e ? e : window.event;
var bt = document.getElementById(
if (bt){
if (evt.keyCode == 13){
bt.click();
return false;
}
}
}
</script>
in Code behind:
if (!IsPostBack)
{
Textsearch.Attributes.Add("
}
Here after any keypress in the text seach box it will take to the search button click instead of default button
--------------------------------------------------------------------------
or
In form tag only we can set the Default focus and default button for a form as below
<form id="form1" runat="server" defaultfocus="Textsearch" defaultbutton="Btnsearch">
It will take given controls on page load...
No comments:
Post a Comment