海阔天空

导航

AjaxMethod方法

<script runat="server">

        [AjaxMethod]

        public void bc()

        {

           throw new Exception("报错啦!");


        }

         [AjaxMethod]

        public void zz()

        {

            try { throw new Exception("报错了!!!!!"); }

            catch (Exception e)

            {

                Coolite.Ext.Web.ScriptManager.AjaxSuccess = false;

                Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = e.Message;


            }


        }

    </script>

    <form id="form1" runat="server">

    <ext:ScriptManager runat="server" AjaxMethodNamespace="ajax" Theme="Slate">

       <CustomListeners >

         <ext:Listener Target="bb" Handler="ajax.zz({failure:function(msg){Ext.Msg.alert('提示',msg);}});" />

       </CustomListeners>

    </ext:ScriptManager>

   

    <div>

     <ext:Button ID="b1" runat="server" Text="报错" Icon="XhtmlGo">

     <Listeners>

        <Click Handler="ajax.bc({ failure: function (msg) { Ext.Msg.alert('警告', msg); } });" />

     </Listeners>

     </ext:Button>

     <br />

     <input id="bb" type="button" value="点我啊!" />

    </div>

    </form>

posted on 2010-05-29 08:18  达芬奇  阅读(749)  评论(0编辑  收藏  举报