用js前台弹出,搜索js 弹窗

解决方案 »

  1.   


    找一个jquery的组件,在后台封装一下。
    然后照样在cs代码中调用,前台也不会刷新。
    http://www.open-lib.com/Type/175-1.jsp
      

  2.   


    如果就是需要在后台弹出,用下面这种方式吧:
    ScriptManager.RegisterStartupScript(this, this.GetType(), "EditSuccess", "alert('" + message + "');", true);第三个参数是key,不填也行
    第四个参数是你的javascript
    第五个参数是addScriptTags,我一般默认是true,不太清楚啥意思。注意点: 你页面上要有
     <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>你可以试试.
      

  3.   

    不要用Response.Write();
    你可以定义一个控件,在后台用这个控件的点击方法打开,这样就不会有回传了
    HyperLink hl_1 = (HyperLink)e.Item.FindControl("hl_1");
    hl_1.Attributes.Add("onclick", "window.showModalDialog('cust_one.aspx?ID=" + strCust_ID + "','客商信息维护','dialogWidth:800px;dialogHeight:600px;center:true;help:no;resizeable:yes;status:yes'");
      

  4.   


    如果就是需要在后台弹出,用下面这种方式吧:
    ScriptManager.RegisterStartupScript(this, this.GetType(), "EditSuccess", "alert('" + message + "');", true);第三个参数是key,不填也行
    第四个参数是你的javascript
    第五个参数是addScriptTags,我一般默认是true,不太清楚啥意思。注意点: 你页面上要有
     <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>你可以试试.
    用下面这种也是可以的:
    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('Please Choose Region.')</script>");
      

  5.   

    那就不能在GridView1_SelectedIndexChanged事件中去处理        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if(e.Row.RowIndex>=0)
                {
                    string strCust_ID = e.Row.Cells[2].Text.Trim();//ID                e.Row.Attributes.Add("onclick","showModalDialog('cust_one.aspx?ID=" + strCust_ID + "','客商信息维护','dialogWidth:800px;dialogHeight:600px;center:true;help:no;resizeable:yes;status:yes')");
                }
            }
      

  6.   

    1、弹出提示框代码:ScriptManager.RegisterStartupScript(this.Page, this.GetType(),"onekey", "alert('弹出')", true);
     2、 需要在配合UpdatePanel控件使用:
            a)   在Page_Load方法中用ScriptManager1.RegisterAsyncPostBackControl()来注册一下要实现异步更新的控件
            b)   把页面上所有的UpdatePanel控件的UpdateMode设为Conditional。
            c)   ScriptManager1.RegisterAsyncPostBackControl(this.Button2);实现对Button2的注册。
            d)   在Button2控件的Click事件中后面加入后面的代码:UpdatePanel1.Update(); 
           这样Button2按钮只对UpdatePanel1控件实现的异步的局部刷新。尽量使UpdatePanel1包含的控件少,局部刷新就快。
           提示框代码ScriptManager.RegisterStartupScript(this.Page, this.GetType(),"onekey", "alert('弹出')", true);也写在Button2控件的       Click事件中,这样弹出的提示框实质是有部分刷新,但几乎是达到无刷新效果。我试过了,成功了。
      

  7.   

    ClientScript.RegisterStartupScript()用这个方法注册JS事件就好了,用Response.Write()肯定会刷新的