<script language="javascript" type="text/javascript">
function f_submit()
{
   var a = "<%=Control_login.ss()%>"; 
}
</script>后台函数
public Boolean ss()
    {
        string userName = this.txtUserName.Text;
        DataTable dt = new DataTable();
        dt = ctl.selectPersonal(userName);
        if (dt.Rows.Count == 0)
        {
            com.Alert("用户名不正确");
            return false;
        }
        if ((dt.Rows[0][1].ToString()) == com.StringToMD5(this.txtPassword.Text))
        {
            Session["perName"] = userName;
            if (this.ckRemPassword.Checked.Equals(true))
            {
                HttpCookie cookie = new HttpCookie("www.zztg.com.cn");
                cookie.Values.Add("userName", this.txtUserName.Text);
                cookie.Values.Add("password", com.StringToMD5(this.txtPassword.Text));
                cookie.Expires = DateTime.Now.AddDays(30d);
                Response.Cookies.Add(cookie);
            }
            Response.Redirect("~/Personal/PersonalManager.aspx?userName=" + userName + "");
        }
        else
        {
            com.Alert("密码不正确");
            return true;
        }
        return false;
    }
错误 3 非静态的字段、方法或属性“Control_login.ss()”要求对象引用 E:\学习\tg\Control\login.ascx 5

解决方案 »

  1.   

    调试的时候   出现这个问题
    错误 3 非静态的字段、方法或属性“Control_login.ss()”要求对象引用 E:\学习\tg\Control\login.ascx 5 
    怎么解决!!!!!
      

  2.   

    public static Boolean ss() 
      

  3.   

    <script language="javascript" type="text/javascript"> 
    function f_submit() 

       var a = " <%=ss()%>";  

    </script> 
      

  4.   

    没试过直接用,记得曾经用AjaxMethod 声明来调用。