点击按钮时实现的功能。首先单击按钮,弹出遮罩层,同时向数据库插入数据,显示gif进度条。当数据插入完毕,进度条消失,遮罩层消失。现在面临最大问题:如何获取数据是否插入完毕,插入完毕后又如何让遮罩层消失。。1、要有遮罩层 
2、向数据库中插入数据时候实现的 
3.在添加数据库的时候,在页面上显示GIF进度条,等数据查询完毕时,进度条就消失,不知各位能否提供一个参考 
4,面向asp.net的 
,发邮箱最好[email protected]

解决方案 »

  1.   


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
        <script type="text/javascript">
        function  callBackUName(data)
        {
            //回调函数,这里你想干什么就干什么(比如说你的跳转)
            alert(data);
            document.getElementById("testImg").src=""
        }
        function loadDo()
        {
            document.getElementById("testImg").src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif";
            <%=GetCallBackReference(this.Page, String.Empty, "callBackUName", String.Empty) %>
        }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <img  src="" id="testImg"/>
            <input type="button" id="text" value="test" onclick="testCallBack()" />
        </form>
    </body>
    <script>
        function testCallBack() {
            loadDo();
        }
    </script>
    </html>using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Threading;namespace WebApplication1
    {
        public partial class WebForm1 : System.Web.UI.Page,ICallbackEventHandler
        {
            protected void Page_Load(object sender, EventArgs e)
            {   
            }        #region ICallbackEventHandler 成员
            String result = "123";
            public string GetCallbackResult()
            {
                return result;
            }        public void RaiseCallbackEvent(string eventArgument)
            {
                Thread.Sleep(1000);
            }
            #endregion
            public static string GetCallBackReference(Page page, string arg, string callbackFunction, string context)
            {
                return GetCallBackReference(page, arg, callbackFunction, context, true);
            }        public static string GetCallBackReference(Page page, string arg, string callbackFunction, string context, bool useAsync)
            {
                const string callbackScript = "__theFormPostData = \"\";\n__theFormPostCollection = new Array();\nWebForm_InitCallback();\n{0};\n";
                return string.Format(callbackScript, page.ClientScript.GetCallbackEventReference(page, arg, callbackFunction, context, useAsync));
            }    }
    }
      

  2.   


    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sync.aspx.cs" Inherits="System_Sync_Sync" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>test</title>   
        
        <style type="text/css">
    <!--
    .STYLE1{
    color: #FF0000;
    font-weight: bold;
    }
    .STYLE2{
    color: #848484;
    font-weight: bold;
    }
    .style3{
    color:#ff0000; font-size:14px; font-weight:bold;
    }
    #show_box{
    border:#f9761b 2px solid;
    width:378px;
    background-color:#f3f3f3;
    position:absolute;
    left:50%;
    top:50%;
    margin:-120px 0 0 -200px;
    }
    .close{
    background-color:#f3f3f3;
    width:378px;
    line-height:28px;
    }
    .z{
    margin:auto;
    width:278px;
    }
    .tt{
    font-size:12px; color:#848484; border-bottom:#CCCCCC 1px solid; line-height:24px;
    }
    -->
    </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:Panel ID="p1" runat="server">
        <div id="show_box" style="display:none;">  
    <div class="close">
    <div align="right">&nbsp;&nbsp;</div>
    </div>
    <div class="z">
    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 200">
                    <tr>
                        <td valign="middle" align="center"><img src="../../Images/pic1.gif" /> 正在操作,请耐心等候...<br /><br />
                        <img src="../../Images/load.gif" />
                        </td>
                    </tr>
                </table>
    </div></div>
    </asp:Panel>
            <table id="maintb" style="width: 100%;" class="content">
                <tr>
                    <td style="padding-left: 20px; padding-top:20px;">     
                            <asp:Button ID="btnTest" runat="server" Text="测试" OnClick="btnTest_Click"
                                OnClientClick="showBox();" />
                            <br />
                    </td>
                </tr>
            </table>
        </form>
        <script language="javascript" type="text/javascript">
     function showBox(){
        document.getElementById("show_box").style.display = "block";
        document.body.style.backgroundColor="#666666";
     }
     function initStyle()
     {
        document.body.style.backgroundColor="#FFFFFF";
     }
     initStyle();
     </script>
    </body>
    </html>
    [code=C#]
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;using BLL;
    using Common;
    using Model;public partial class System_Sync_Sync : Page
    {
        //SyncBLL syncBll = new SyncBLL();    protected void Page_Load(object sender, EventArgs e)
        {
            p1.Visible = true;
        }
        private void doTest()
        {
            int returnValue = 0;        try
            {
                //returnValue = syncBll.Sync(syncCategory, ddlRegion.SelectedValue);            string msg = string.Empty;            if (returnValue > 0)
                {
                    msg = "操作成功";
                }
                else
                {
                    msg = "操作失败";
                }
                ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Add", "alert('" + msg + "');", true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Add", "alert('" + ex.Message + "');", true);
            }
        }    protected void btnTest_Click(object sender, EventArgs e)
        {
            this.doTest();
        }
    }
    [/code]