CallServer 使用

来源:互联网 发布:mac版ai的zh cn汉化包 编辑:程序博客网 时间:2024/04/29 19:40

 string value = "";

    public string GetCallbackResult()

    {

        return value;

    }

    /// <summary>

    /// 这是判断数据库中是不是已经有了该广告的方法

    /// </summary>

    /// <param name="eventArgument"></param>

    public void RaiseCallbackEvent(string eventArgument)

    {

        if (ValidateTitle())

        {

            value = "1";

        }

        else

        {

            value = "0";

        }

    }

 

 

<script type="text/javascript">

        //调用服务器端得方法

        function CallServer() 

        {   

            var value =document.getElementById("txtTitle").value; 

            <%= ClientScript.GetCallbackEventReference(this, "value", "CheckExists","")%>; 

        } 

 

       function CheckExists(value)

       {

            if(value >= 1)

            {

                alert("该品牌推荐名称已经存在,请换别的名称");

            }

            else

            {

                alert("此名称可以使用!");

            }

 

       }

    </script>

原创粉丝点击