我在.aspx文件中写了一段验证代码:
function btnSearch_Click(oButton, oEvent){
//Add code to handle your event here.
var editor = igedit_getById("WebPanel1_WebStaMainSelect1_ctrlCorpID");
var text =editor.getValue();
if(text=="")
alert("请输入企业编号。");
}
现在的问题是提示信息后,页面还会继续刷新一次,怎样才能在提示信息后不在提交页面呢?

解决方案 »

  1.   

    function btnSearch_Click(oButton, oEvent){
    //Add code to handle your event here.
    var editor = igedit_getById("WebPanel1_WebStaMainSelect1_ctrlCorpID");
    var text =editor.getValue();
    if(text==""){
    alert("请输入企业编号。");return false ;
    }
    return true ;}然后 <form onsubmit="return btnSearch_Click('','')"
      

  2.   

    <ClientSideEvents Click="return btnSearch_Click('','');"></ClientSideEvents>我在提交按钮中写如上代码,提示信息都不显示了,好像没有调用到方法。
      

  3.   

    <form onsubmit="return btnSearch_Click('','')">这样应该可以吧,学习。
      

  4.   

    我用的是第三方的控件按钮,Infragistics.WebUI.WebDataInput.WebImageButton
    在Form中写入代码没用。我是用用户控件把一些输入框和按钮放在一起的,而代码是在引用它的页面中的。用户控件中又没有Form?