无刷新+动态添加行操作gridview(暂无分页)

js代码块

var xmlRequest;
function getXMLRequestObject() {
    if (window.XMLHttpRequest) {
        //针对FireFox,Mozillar,opera,safari,IE7,IE8
        xmlRequest = new XMLHttpRequest();
        //针对某些特定版本的mozillar浏览器的bug修正
        if (xmlRequest.overrideMimeType) {
            xmlRequest.overrideMimeType("text/xml")
        }
    } else if (window.ActiveXObject) {
        //针对IE5,IE5.5,IE6(IE7,IE8)
        //两个可以用于创建XMLHTTPRequest对象的控件名称,保存在一个js数组中
        //排在前面的版本较新
        var activexName = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
        for (var i = 0; i < activexName.length; i++) {
            try {
                //取出一个控件名进行创建,如果创建成功就终止循环
                //如果创建失败,抛出异常,然后继续循环,继续尝试创建
                xmlRequest = new ActiveXObject(activexName[i]);
                break;
            } catch (e) {
            }
        }
    }
    return xmlRequest
}
function getData(flag, projectId, OID, investor) {
    var url = "ProjectInfoAjax.aspx?projectId=" + projectId + "&OID=" +escape(OID) + "&investor=" +escape(investor) + "";
    //得到请求对象 
    xmlRequest = getXMLRequestObject();
    if (xmlRequest == null) {
        alert("您的浏览器不支持AJAX!");
        return;
    }
    //load 表示是页面加载数据
    if (flag == "load") {
        url += "&flag=load";
        //状态改变 
        xmlRequest.onreadystatechange = dataChanged;
        xmlRequest.open("GET", url, true);
        xmlRequest.send(null);  // 发送请求 

    }
    else if (flag == "add") {  //add 表示是页面添加数据动作 
        //简单验证数据 
        if (investor == "0") {
            var enteName = document.getElementById("txtEnteName").value;
            var nationality = document.getElementById("txtNationality").value;
            var leader;
            var leaderRadio = document.getElementById("rbtnlLeader");
            var leaderList = leaderRadio.getElementsByTagName("INPUT");
            for (var i = 0; i < leaderList.length; i++) {
                if (leaderList[i].checked) {
                    leader = leaderList[i].value;
                }
            }
            var topFive;
            var topFiveRadio = document.getElementById("rbtnlTopFive");
            var topFiveList = topFiveRadio.getElementsByTagName("INPUT");
            for (var i = 0; i < topFiveList.length; i++) {
                if (topFiveList[i].checked) {
                    topFive = topFiveList[i].value;
                }
            }
            //拼接请求的字符串
            url += "&flag=add&enteName=" + escape(enteName) + "&nationality=" + escape(nationality) + "&leader=" + escape(leader) + "&topFive=" + escape(topFive) + "";
        }
        else {
            var enteName = document.getElementById("txtEnteName2").value;
            var ddlNational = document.getElementById("ddlNational");
            var nationality = ddlNational.options[ddlNational.selectedIndex].value;
            var leaderRadio = document.getElementById("rbtnlLeader2");
            var leaderList = leaderRadio.getElementsByTagName("INPUT");
            for (var i = 0; i < leaderList.length; i++) {
                if (leaderList[i].checked) {
                    leader = leaderList[i].value;
                }
            }
            var topFive;
            var topFiveRadio = document.getElementById("rbtnlTopFive2");
            var topFiveList = topFiveRadio.getElementsByTagName("INPUT");
            for (var i = 0; i < topFiveList.length; i++) {
                if (topFiveList[i].checked) {
                    topFive = topFiveList[i].value;
                }
            }
            var investCompany;
            var investCompanyRadio = document.getElementById("rbtlInvestCompany");
            var investCompanyList = investCompanyRadio.getElementsByTagName("INPUT");
            for (var i = 0; i < investCompanyList.length; i++) {
                if (investCompanyList[i].checked) {
                    investCompany = investCompanyList[i].value;
                }
            }
            //拼接请求的字符串
            url += "&flag=add&enteName=" + escape(enteName) + "&nationality=" + escape(nationality) + "&leader=" + escape(leader) + "&topFive=" + escape(topFive) + "&investCompany=" + escape(investCompany) + "";
        }
        //        //简单判断是否完整 
        //        if (title == "" || description == "") {
        //            alert("信息不完整!");
        //            // document.myform.newname.focus(); 
        //            return;
        //        }

        url = encodeURI(url);

        //状态改变 
        xmlRequest.onreadystatechange = dataChanged;
        xmlRequest.open("POST", url, true);
        xmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        xmlRequest.send(url);  // 发送请求 
    }
    else if (flag == "delete") {
        if (confirm("确认要删除吗?")) {
            url += "&flag=delete";
            //状态改变 
            xmlRequest.onreadystatechange = dataChanged;
            xmlRequest.open("GET", url, true);
            xmlRequest.send(null);  // 发送请求 
        }
        else {
            return;
        }
    }
    else if (flag == "update") {
        //简单验证数据

        if (investor == "0") {
            var enteName = document.getElementById("enteName" + OID + "").value;
            var nationality = document.getElementById("nationality" + OID + "").value;
            var leader;
            var leaderList = document.getElementsByName("industryLeader" + OID + "");
            for (var i = 0; i < leaderList.length; i++) {
                if (leaderList[i].checked) {
                    leader = leaderList[i].value;
                }
            }
            var topFive;
            var topFiveList = document.getElementsByName("topFiveHundred" + OID + "");
            for (var i = 0; i < topFiveList.length; i++) {
                if (topFiveList[i].checked) {
                    topFive = topFiveList[i].value;
                }
            }

            //        //简单判断是否完整 
            //        if (title == "" || description == "") {
            //            alert("信息不完整!");
            //            // document.getElementById(id+"name").focus(); 
            //            return;
            //        }

            //拼接请求的字符串 

            url += "&flag=update&enteName=" + escape(enteName) + "&nationality=" + escape(nationality) + "&leader=" + escape(leader) + "&topFive=" + escape(topFive) + "";
        }
        else {
            var enteName = document.getElementById("enteName2" + OID + "").value;
            var ddlNational = document.getElementById("ddlNational2" + OID + "");
            var nationality = ddlNational.options[ddlNational.selectedIndex].text;
            var leader;
            var leaderList = document.getElementsByName("industryLeader2" + OID + "");
            for (var i = 0; i < leaderList.length; i++) {
                if (leaderList[i].checked) {
                    leader = leaderList[i].value;
                }
            }
            var topFive;
            var topFiveList = document.getElementsByName("topFiveHundred2" + OID + "");
            for (var i = 0; i < topFiveList.length; i++) {
                if (topFiveList[i].checked) {
                    topFive = topFiveList[i].value;
                }
            }
            var investCompany;
            var investCompanyList = document.getElementsByName("investCompany" + OID);
            for (var i = 0; i < investCompanyList.length; i++) {
                if (investCompanyList[i].checked) {
                    investCompany = investCompanyList[i].value;
                }
            }
            url += "&flag=update&enteName=" + escape(enteName) + "&nationality=" + escape(nationality) + "&leader=" + escape(leader) + "&topFive=" + escape(topFive) + "&investCompany=" + investCompany + "";
        }
        url = encodeURI(url);
        //状态改变 
        xmlRequest.onreadystatechange = dataChanged;
        xmlRequest.open("POST", url, true);
        xmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        xmlRequest.send(url);  // 发送请求 
    }
    else if (flag = "save") {
        url += "&flag=save";
        //状态改变 
        xmlRequest.onreadystatechange = dataChanged;
        xmlRequest.open("GET", url, true);
        xmlRequest.send(null);  // 发送请求 
    }
}
function dataChanged() {
    if (xmlRequest.readyState == 4 && xmlRequest.status == 200) {
        showDatas(); //已经可以正常接受数据 
    }
}

//表格部分显示数据 
function showDatas() {
    //从响应页面得到数据
var message = xmlRequest.responseText;
var subMessage = message.substr(message.indexOf("<center>",0), message.lastIndexOf("</center>"));
    //显示数据
    var ss = document.getElementById("dataDiv");
    document.getElementById("dataDiv").innerHTML = subMessage;

    if (document.getElementById("tbHeader1") != null) {
        CopyTable("tdAdd1", "tbHeader1");
    }
    else {
        CopyTable("tdAdd1", "gvInvestor1");
    }
    if (document.getElementById("tbHeader2") != null) {
        CopyTable("tdAdd2", "tbHeader2");
    }
    else {
        CopyTable("tdAdd2", "gvInvestor2");
    }
}
//显示表格编辑的数据
function changeView(OID, enteName, nationality, industryLeader, topFiveHundred, investCompany, projectId, investor) {
    if (investor == "0") {
        objEnteName = document.getElementById('divEnteName' + OID);
        objNationality = document.getElementById('divNationality' + OID);
        objLeader = document.getElementById('divLeader' + OID);
        objTopFive = document.getElementById('divTopFive' + OID);
        objmanage = document.getElementById('divEdit' + OID);
        objEnteName.innerHTML = "<input type='text' class='wd' name='enteName" + OID + "' id='enteName" + OID + "'  value='" + enteName + "'>";
        objNationality.innerHTML = "<input type='text' class='wd' name='nationality" + OID + "' Width='250px' Height='20px' id='nationality" + OID + "'  value='" + nationality + "'>";
        if (industryLeader == "False") {
            objLeader.innerHTML = "<input type='radio' name='industryLeader" + OID + "' id='industryLeader" + OID + "'  value='False' checked='true' />否"
        + "<input type='radio' name='industryLeader" + OID + "' id='industryLeader" + OID + "' value='True'>是";
        }
        else {
            objLeader.innerHTML = "<input type='radio'  name='industryLeader" + OID + "' id='industryLeader" + OID + "'  value='False'  />否"
        + "<input type='radio' name='industryLeader" + OID + "' id='industryLeader" + OID + "' value='True' checked='true'>是";
        }
        if (topFiveHundred == "False") {
            objTopFive.innerHTML = "<input type='radio' name='topFiveHundred" + OID + "' id='topFiveHundred" + OID + "'  value='False' checked='true' />否"
        + "<input type='radio' name='topFiveHundred" + OID + "' id='topFiveHundred1" + OID + "' value='True' title='是'>是";
        }
        else {
            objTopFive.innerHTML = "<input type='radio' name='topFiveHundred" + OID + "' id='topFiveHundred" + OID + "'  value='False' />否"
        + "<input type='radio' name='topFiveHundred" + OID + "' id='topFiveHundred1" + OID + "' value='True' title='是' checked='true' />是";
        }
        objmanage.innerHTML = "<a href=javascript:getData('update','" + escape(projectId) + "','" + escape(OID) + "','" + escape(investor) + "')>更新</a> &nbsp;<a href=javascript:getData('update','" + escape(projectId) + "','" + escape(OID) + "','" + escape(investor) + "')>取消</a>";
    }
    else {
        objEnteName = document.getElementById('divEnteName2' + OID);
        objNationality = document.getElementById('divNationality2' + OID);
        objLeader = document.getElementById('divLeader2' + OID);
        objTopFive = document.getElementById('divTopFive2' + OID);
        objInvestCompany = document.getElementById('divInvestCompany' + OID);
        objmanage = document.getElementById('divEdit2' + OID);
        objEnteName.innerHTML = "<input type='text' Width='99%' class='wd' Height='20px' name='enteName2" + OID + "' id='enteName" + OID + "'  value='" + enteName + "'>";
        objNationality.innerHTML = "<select name='ddlNational' class='wd' id='ddlNational2" + OID + "'>"
                                  + "<option>美国</option>"
                                  + "<option>加拿大</option>"
                                  + "<option>日本</option>"
                                  + "<option>韩国</option>"
                                  + "<option>香港</option>"
                                  + "<option>台湾</option>"
                                  + "<option>澳门</option>"
                                  + "<option>新加坡</option>"
                                  + "<option>德国</option>"
                                  + "<option>法国</option>"
                                  + "<option>意大利</option>"
                                  + "<option>瑞士</option>"
                                  + "<option>荷兰</option>"
                                  + "<option>瑞典</option>"
                                  + "<option>以色列</option>"
                                  + "<option>丹麦</option>"
                                  + "<option>俄罗斯</option>"
                                  + "<option>土耳其</option>"
                                  + "<option>其他</option>"
                                  + "<option></option></select>";
        var ddlNational = document.getElementById("ddlNational2" + OID + "");
        ddlNational.options[ddlNational.selectedIndex].text=nationality;
        if (industryLeader == "False") {
            objLeader.innerHTML = "<input type='radio' name='industryLeader" + OID + "' id='industryLeader2" + OID + "'  value='False' checked='true' />否"
        + "<input type='radio' name='industryLeader" + OID + "' id='industryLeader2" + OID + "' value='True'>是";
        }
        else {
            objLeader.innerHTML = "<input type='radio'  name='industryLeader" + OID + "' id='industryLeader2" + OID + "'  value='False'  />否"
        + "<input type='radio' name='industryLeader" + OID + "' id='industryLeader2" + OID + "' value='True' checked='true'>是";
        }
        if (topFiveHundred == "False") {
            objTopFive.innerHTML = "<input type='radio' name='topFiveHundred" + OID + "' id='topFiveHundred2" + OID + "'  value='False' checked='true' />否"
        + "<input type='radio' name='topFiveHundred" + OID + "' id='topFiveHundred2" + OID + "' value='True' title='是'>是";
        }
        else {
            objTopFive.innerHTML = "<input type='radio' name='topFiveHundred" + OID + "' id='topFiveHundred2" + OID + "'  value='False' />否"
        + "<input type='radio' name='topFiveHundred" + OID + "' id='topFiveHundred2" + OID + "' value='True' title='是' checked='true' />是";
        }
        if (investCompany == "False") {
            objInvestCompany.innerHTML = "<input type='radio' name='investCompany" + OID + "' id='investCompany" + OID + "'  value='False' checked='true' />否"
        + "<input type='radio' name='investCompany" + OID + "' id='investCompany" + OID + "' value='True' title='是'>是";
        }
        else {
            objInvestCompany.innerHTML = "<input type='radio' name='investCompany" + OID + "' id='investCompany" + OID + "' value='False' />否"
        + "<input type='radio' name='investCompany" + OID + "' id='investCompany" + OID + "' value='True' title='是' checked='true' />是";
        }
        objmanage.innerHTML = "<a href=javascript:getData('update','" + escape(projectId) + "','" +escape(OID) + "','" +escape(investor) + "')>更新</a> &nbsp;<a href=javascript:getData('update','" + escape(projectId) + "','" +escape(OID) + "','" +escape(investor) + "')>取消</a>";
    }
}
//复制表格到gridview(此js兼容性不强)
function CopyTable(source, dest) {
    var row;
    var cell;
    var sourceTable = document.getElementById(source);
    var destTable = document.getElementById(dest);
    if (destTable != null) {
        for (var i = 0; i < sourceTable.rows.length; i++) {
            row = document.createElement("TR");
            for (var j = 0; j < sourceTable.rows(i).cells.length; j++) {
                cell = document.createElement("TD");
                row.appendChild(cell);
                for (var k = 0; k < sourceTable.rows(i).cells(j).all.length; k++) {
                    cell.appendChild(sourceTable.rows(i).cells(j).all.item(k));
                }
            }
            destTable.tBodies(0).appendChild(row);
        }
    }
}

html页面

<%@ Page Title="" Language="C#" MasterPageFile="~/2052/Controls/MasterPageInput.master" AutoEventWireup="true" CodeFile="Form.aspx.cs" Inherits="_2052_Aspx_ProjectManage_ProjectInfo_Form"  Theme ="blue"  %>

<%@ MasterType VirtualPath="~/2052/Controls/MasterPageInput.master" %>
<%@ Register Src="~/2052/aspx/WorkFlow/WorkFlowWUC.ascx" TagName="WorkFlowWUC" TagPrefix="uc3" %>
<%@ Register src="http://www.cnblogs.com/../Controls/ListChoose.ascx" tagname="ListChoose" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script src="http://www.cnblogs.com/../Scripts/FinstoneJS.js" type="text/javascript"></script>
    <script src="http://www.cnblogs.com/../Scripts/CssControl.js" type="text/javascript"></script>
    <script src="ProjectInfo.js" type="text/javascript"></script>
    <script type ="text/javascript" >
         function UpLoadFj()
        {
            var txtFileNameList_ClientID=<%="'"+TxtFileNameList.ClientID.ToString()+"'"%>;
            var txtFilePath_ClientID=<%="'"+TxtFilePath.ClientID.ToString()+"'" %>;
            var lblLink_ClientID=<%="'"+lblLink.ClientID.ToString()+"'" %>;
            var name=escape(document.getElementById(txtFileNameList_ClientID).value);
            var path=escape(document.getElementById(txtFilePath_ClientID).value);   
            var url="/2052/Controls/UpLoadFile2.aspx?SavePath=Project&VH=w&Name="+name+"&Path="+path+"&txtName="+txtFileNameList_ClientID+"&txtPath="+txtFilePath_ClientID+"&txtLink="+lblLink_ClientID;
            window.open(url,"UploadFile","Height:350px;Width:400px;scroll:yes") ;
        }
    </script>
    <script type="text/javascript">
        window.onload = function () {
            var projectId = document.getElementById("<%=this.TxtOid.ClientID%>").value;
            if (projectId != "") {
                getData('load', projectId, '', '0');
            }
        }
    </script>
   
    <table border="0" cellpadding="0px" cellspacing="0" style="width: 99%;">
        <tr>
            <td style="text-align :right;">
                项目名称:
            </td>
            <td colspan="3" style="width:26%;">
                <asp:TextBox ID="txtProjectName" runat="server" CssClass="text2" Width="93%" ></asp:TextBox>
            </td>
              <td style="text-align:right">
                  <asp:Label ID="Label1" runat="server" Text="信息类别:"></asp:Label>
            </td>
              <td style="width:26%">
                  <asp:DropDownList ID="ddlInfoType" runat="server" Width="40%" style="float:left;">
                  <asp:ListItem>新设</asp:ListItem>
                  <asp:ListItem>增资</asp:ListItem>
                  <asp:ListItem>并购</asp:ListItem>
                  <asp:ListItem>扩股</asp:ListItem>
                  <asp:ListItem>其他</asp:ListItem>
                  </asp:DropDownList>
                  <asp:Label ID="Label3" runat="server" Text="重点项目:"
                      style="float:left;padding-top:5px;width:28%; text-align: right;"></asp:Label>
                  <asp:RadioButtonList ID="rbtnImportance" runat="server"
                      RepeatDirection="Horizontal">
                      <asp:ListItem Value="false" Selected="True">否</asp:ListItem>
                      <asp:ListItem Value="true">是</asp:ListItem>
                  </asp:RadioButtonList>
            </td>
            <td style="text-align :right;">
                <asp:Label ID="Label2" runat="server" Text="项目状态:"></asp:Label>
            </td>          
            <td style="width:26%">
                <asp:DropDownList ID="ddlStatus" runat="server" Width="100%">
                    <asp:ListItem >本月新增</asp:ListItem>
                    <asp:ListItem >在谈</asp:ListItem>
                    <asp:ListItem >拟报批</asp:ListItem>
                    <asp:ListItem >即办</asp:ListItem>
                    <asp:ListItem >已办结</asp:ListItem>
                    <asp:ListItem >终止</asp:ListItem>
                </asp:DropDownList>
            </td>          
        </tr>
                <tr>
        <td>&nbsp;</td>
        </tr>
        <tr>
          <td style="text-align :right;">信息获取年份:</td>
            <td colspan="3" style="margin-left:5px;" >
                <asp:DropDownList ID="ddlYear" runat="server" Width="93%">
                    <asp:ListItem>2009年</asp:ListItem>
                    <asp:ListItem>2010年</asp:ListItem>
                    <asp:ListItem>2011年</asp:ListItem>
                    <asp:ListItem>2012年</asp:ListItem>
                    <asp:ListItem>2013年</asp:ListItem>
                    <asp:ListItem>2014年</asp:ListItem>
                    <asp:ListItem>2015年</asp:ListItem>
                    <asp:ListItem>2016年</asp:ListItem>
                    <asp:ListItem>2017年</asp:ListItem>
                    <asp:ListItem>2018年</asp:ListItem>
                    <asp:ListItem>2019年</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td style="text-align:right">信息获取月份:</td>
            <td style="text-align :left; ">
                <asp:DropDownList ID="ddlMonth" runat="server" Height="22px" Width="93%">
                    <asp:ListItem>1月</asp:ListItem>
                    <asp:ListItem>2月</asp:ListItem>
                    <asp:ListItem>3月</asp:ListItem>
                    <asp:ListItem>4月</asp:ListItem>
                    <asp:ListItem>5月</asp:ListItem>
                    <asp:ListItem>6月</asp:ListItem>
                    <asp:ListItem>7月</asp:ListItem>
                    <asp:ListItem>8月</asp:ListItem>
                    <asp:ListItem>9月</asp:ListItem>
                   <asp:ListItem>10月</asp:ListItem>
                   <asp:ListItem>11月</asp:ListItem>
                   <asp:ListItem>12月</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td style="text-align :right;">
                  产&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 业:</td>          
            <td >               
                <asp:DropDownList ID="ddlIndustry" runat="server" Width="100%">
                    <asp:ListItem >农业</asp:ListItem>
                    <asp:ListItem >制造业</asp:ListItem>
                    <asp:ListItem >服务业</asp:ListItem>
                </asp:DropDownList>
               
            </td>          
        </tr>
        <tr>
        <td>&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align :right;">投资总额:</td>
            <td colspan="3" style="text-align :left;"><asp:TextBox ID="txtTotalInvestment" runat="server"  Width="80%" onfocus="ClearText(this)">0</asp:TextBox>(万美元)</td>
            <td style="text-align:right;">注册资本:</td>
            <td style=" text-align :left;"><asp:TextBox ID="txtRegisteredCapital" runat="server"  Width="80%" onfocus="ClearText(this)">0</asp:TextBox>(万美元)</td>
            <td style="text-align :right;">注册外资:</td>
            <td style="text-align :left;"><asp:TextBox ID="txtRegisteredForeign" runat="server"  Width="80%" onfocus="ClearText(this)">0</asp:TextBox>(万美元)</td>
        </tr>
        <tr>
        <td>&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align :right;">投资中方:</td>
            <td colspan="7" rowspan="2" style="text-align:left"><div id="dataDiv"></div></td>
        </tr>
        <tr>
            <td style="text-align :right;">投资外方:</td>
        </tr>
        <tr>
        <td>&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align :right;">进展情况:</td>
            <td colspan="7" style="text-align:left;"><asp:TextBox ID="txtProgressCase"
                    runat="server" Width="100%"
                    TextMode="MultiLine">(请输入100字以内字符)</asp:TextBox>
                </td>
        </tr>
                <tr>
        <td>&nbsp;</td>
        </tr>
        <tr>
            <td style="text-align :right;">
                责任单位:
            </td>
            <td colspan="2" style="height: 14px;text-align:center;" >        
                <asp:Label ID="lblResponsibleUnits" runat="server" Text="Label"></asp:Label>
            </td>
            <td colspan="5">
                <asp:Label ID="Label4" runat="server" Text="责任人:"></asp:Label>
            
                <asp:DropDownList ID="ddlResponsiblePersonal" runat="server" Width="26%">
                </asp:DropDownList>&nbsp;&nbsp;&nbsp;
                合作单位:<asp:DropDownList ID="ddlPartnerUnit"
                    runat="server" Width="26%"
                    AutoPostBack="True"
                    onselectedindexchanged="ddlPartnerUnit_SelectedIndexChanged">
                </asp:DropDownList>&nbsp;&nbsp;&nbsp;
                合作人:<asp:DropDownList ID="ddlPartner" runat="server" Width="26%">
                </asp:DropDownList>
               </td>
        </tr>
                <tr>
        <td>&nbsp;</td>
        </tr>
        <tr>
            <td style=" text-align :right;">
                所在区域:
              </td>
            <td colspan="7" style="height: 44px"><asp:TextBox ID="txtDistricts" runat="server" Width="97%" CssClass="text2"></asp:TextBox>
             <input id="btnZhusong" type="button" value="..." /> </td>
        </tr>
         <tr>
        <td>&nbsp;</td>
        </tr>
        <tr style="display:none">
            <td style="padding-left: 5px; text-align :right; height: 40px;">
                附&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;件:
            </td>
            <td colspan="7" style="height: 40px">
                <input id="Button4" type="button" value="上载" onclick="UpLoadFj();" />
                <ant:Label ID="lblLink" runat="server"></ant:Label>
            </td>
       </tr>
        </table>
        <table  border="0" cellpadding="0px" cellspacing="0" style="width: 99%;">
        <tr>
            <td style="padding-left: 5px; text-align :right; width:70px;">
                <span>步骤签名:</span>
            
            </td>
            <td style="width:36px"><asp:ImageButton ID="IBbmyj1" runat="server" ImageUrl="~/2052/images/reg.gif" OnClick="IBbmyj1_Click" Visible="False" /></td>
            <td >
            <div runat="server" id="divld" visible="false">
            <asp:TextBox ID="sTbxblr" runat="server" Width="10%"></asp:TextBox>
            [<asp:TextBox ID="sTbxblsj" runat="server" Width="15%"></asp:TextBox>]:
            <asp:TextBox ID="sTbxbcyj" runat="server" Width="70%"></asp:TextBox>
             </div>
            </td>
        </tr>
        </table>
        <table border="0" cellpadding="0px" cellspacing="0" style="width: 99%; margin-bottom :20px; ">
        <tr>
            <td style="padding-left: 5px; text-align :right; width:70px;">
                <span>审核情况:</span>
            </td>
            <td valign="middle" colspan="7">
                <div id="yj" visible="True" runat="server">
                    <table id="jbxxTable" width="100%" cellpadding="0" cellspacing="1">
                        <tr>
                            <td width="10%" style="text-align: center;">
                                <span>步骤编号</span>
                            </td>
                            <td width="20%" style="text-align: center;">
                                <span>步骤名称</span>
                            </td>
                            <td width="15%" style="text-align: center;">
                                <span>办理人</span>
                            </td>
                            <td width="20%" style="text-align: center;">
                                <span>办理时间</span>
                            </td>
                            <td width="30%"  style="text-align: center;">
                                <span>办理意见</span>
                            </td>
                        </tr>
                        <%=strLDPS%>
                    </table>
                </div>
            </td>
        </tr>
    </table>
    <div style="display:none;">
        <asp:TextBox ID="tbUserId" runat="server"></asp:TextBox>
        <asp:TextBox ID="TxtOid" runat="server"></asp:TextBox>
        <asp:TextBox ID="textstrbz" runat="server"></asp:TextBox>
        <asp:TextBox ID="TxtFileNameList" runat="server"></asp:TextBox>
        <asp:TextBox ID="TxtFilePath" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtsbuser" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtdept" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtsbdate" runat="server"></asp:TextBox>
    </div>
    <uc3:WorkFlowWUC ID="WorkFlowWUC1" runat="server" />
    <uc1:ListChoose ID="ListChoose1" runat="server" />
    <asp:HiddenField ID="hfDeptID" runat="server" /> 
   <asp:Label ID="lbResults" runat="server" ForeColor="Red"></asp:Label>
 
</asp:Content>

cs.后台代码

using System;
using System.Data;
using System.Web.UI;
using Finstone.ORM;
using Finstone.GZW.Entities;
using System.IO;
using System.Xml;
using System.Web.UI.WebControls;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlClient;


public partial class _2052_Aspx_ProjectManage_ProjectInfo_Form: PageBase
{
    protected CommonComponent cc;
    protected Guid oid;
    private Pro_ProjectBaseInfo project=new Pro_ProjectBaseInfo();
    protected string strLDPS = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        this.ListChoose1.PopupElementID = "btnZhusong";
        this.ListChoose1.ClientTextControlID = this.txtDistricts.ClientID;
        this.ListChoose1.ClientValueControlID = this.hfDeptID.ClientID;
        BindDistricts();
        this.Master.CmdSave.Click += new EventHandler(CmdSave_Click);//激活保存按钮
        this.Master.CmdSubmit.Click += new EventHandler(CmdSubmit_Click);//激活提交按钮
        if (!Page.IsPostBack)
        {
            WebHelper.ClientScriptFactoryHelper.RegisterScript("parent.Maximize__Page()");
            this.Master.CmdSubmit.Visible = true;
            this.textstrbz.Text = "0";
            string AppID = this.WorkFlowWUC1.AppID;
            this.WorkFlowWUC1.Init_WorkFlow();
            BindDept();
            BindNameList(this.ddlPartnerUnit.SelectedItem.Text, this.ddlPartner);
         
            Session["dt"] = null;
            Session["dt2"] = null;
            LoadForm();
            #region 控制按钮的显示
            string strSql = "SELECT [ProSave],[ProSubmit] FROM [FinIport_XBSWJ].[dbo].[Pro_Control]";
            DataSet ds = cc.Retrieves(strSql);
            if (ds.Tables[0].Rows[0][0].ToString() != "True")
            {
                this.Master.CmdSave.Visible = false;
            }
            if (ds.Tables[0].Rows[0][1].ToString() != "True")
            {
                this.Master.CmdSubmit.Visible = false;
            }
            #endregion
        }
        //加载审核情况
        if (ViewState["hegaoyj"] != null)
        {
            ProcessApprove(ViewState["hegaoyj"].ToString());
        }
    }
    private void BindDistricts()
    {
        DataTable dtDistricts = new DataTable();
        dtDistricts.Columns.Add("Districts", typeof(string));
        dtDistricts.Columns.Add("Id", typeof(string));
        DataRow row = dtDistricts.NewRow();
        row[0] = "新北工业园区(春江镇)";
        row[1] = "0";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "孟河镇";
        row[1] = "1";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "新桥镇";
        row[1] = "2";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "薛家镇";
        row[1] = "3";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "罗溪镇";
        row[1] = "4";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "西夏墅镇";
        row[1] = "5";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "河海街道";
        row[1] = "6";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "三井街道";
        row[1] = "7";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "龙虎塘街道";
        row[1] = "8";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "出口加工区";
        row[1] = "9";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "创意产业基地及龙控集团";
        row[1] = "10";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "光伏产业园";
        row[1] = "11";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "生物医药产业园";
        row[1] = "12";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "新能源车辆产业园";
        row[1] = "13";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "常高新集团";
        row[1] = "14";
        dtDistricts.Rows.Add(row);
        row = dtDistricts.NewRow();
        row[0] = "园区办(含生物医药产业园、新能源车辆产业园)";
        row[1] = "15";

        dtDistricts.Rows.Add(row);
        this.ListChoose1.DataTextField = "Districts";
        this.ListChoose1.DataValueField = "Id";
        this.ListChoose1.DataSource = dtDistricts;
        this.ListChoose1.DataBind();
    }
    //加载合作单位
    private void BindDept()
    {
        cc = new CommonComponent();
        DataTable dt = this.cc.RetrieveTable("select oid,deptname from dbo.fip_sys_department where deptcode in('08','09','10','11','12','13','14','15') order by deptcode asc");
        this.ddlPartnerUnit.DataTextField = "deptname";
        this.ddlPartnerUnit.DataValueField = "oid";
        this.ddlPartnerUnit.DataSource = dt;
        this.ddlPartnerUnit.DataBind();
        this.ddlPartnerUnit.Items.Insert(0, new ListItem("---请选择---"));
    }

    //加载人员
    protected void ddlPartnerUnit_SelectedIndexChanged(object sender, EventArgs e)
    {
        BindNameList(this.ddlPartnerUnit.SelectedItem.Text, this.ddlPartner);
        if (this.ddlPartnerUnit.Text == "---请选择---")
        {
            this.ddlPartner.Items.Add(new ListItem("---请选择---"));
        }
        Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','0')</script>");
        Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','1')</script>");
    }
    // 加载人员
    private void BindNameList(string deptName, DropDownList ddl)
    {
        cc = new CommonComponent();
        string str = "where 1=1";
        if (deptName != "---请选择---")
        {
            str = "where deptname='" + deptName + "'";
        }
        DataTable dt = this.cc.RetrieveTable(@"select * from (select  a.oid ,a.name ,a.code  as r from dbo.fip_sys_user a left join dbo.fip_sys_deptusers b
                                              on a.oid=b.uid left join dbo.fip_sys_department c on b.did=c.oid left join aspnet_Membership d on a.oid=d.userid " + str + " and name !='管理员') newtb order by r;");
        ddl.DataTextField = "name";
        ddl.DataValueField = "oid";
        ddl.DataSource = dt;
        ddl.DataBind();
        if (ddl == this.ddlPartner)
        {
            this.ddlPartner.Items.Insert(0, new ListItem("---请选择---"));
        }
    }
    //加载信息
    private void LoadForm()
    {
   
        if (this.WorkFlowWUC1.StepBH != "1" && this.WorkFlowWUC1.StepBH != "5")
        {
            //需要进行签名
            this.IBbmyj1.Visible = true;
            this.divld.Visible = true;
        }
        try
        {
            cc = new CommonComponent();
            if ("add".Equals(Request.QueryString["mopentype"]))
            {
                //新增
                oid = new Guid();
                this.txtsbuser.Text = Me.name;
                this.txtdept.Text = Me.depts[0].ToString();
                this.txtsbdate.Text = DateTime.Now.ToString();
                if (!string.IsNullOrEmpty(Me.depts[0]))
                {
                    this.lblResponsibleUnits.Text = Me.depts[0];//责任单位
                    BindNameList(this.lblResponsibleUnits.Text, this.ddlResponsiblePersonal);//责任人
                }
            }
            else
            {
                if ("open".Equals(Request.QueryString["mopentype"]))
                {//查看
                    oid = new Guid(Request.QueryString["mdocid"]);
                    this.Master.CmdSubmit.Visible = false;
                    this.Master.CmdSave.Visible = false;
                    this.IBbmyj1.Visible = false;
                    this.divld.Visible = false;
                }
                else
                {
                    //修改
                    oid = this.WorkFlowWUC1.GetDocOID();
                    this.txtsbuser.Enabled = false;
                    this.txtdept.Enabled = false;
                    this.txtsbdate.Enabled = false;
                }
                this.project = this.cc.Retrieve<Pro_ProjectBaseInfo>(oid);
                this.TxtOid.Text = oid.ToString();
                ViewState["hegaoyj"] = this.project.hegao;
                this.txtProjectName.Text = project.ProjectName;
                this.ddlInfoType.Text = project.InfoType;
                if (project.IsImportance)
                {
                    this.rbtnImportance.Items[1].Selected = true; ;
                }
                this.txtTotalInvestment.Text = project.TotalInvestment.ToString();
                this.ddlYear.Text = project.Years;
                this.ddlMonth.Text = project.Months;
                this.ddlIndustry.Text = project.Industry;
                this.txtRegisteredCapital.Text = project.RegisteredCapital.ToString();
                this.txtRegisteredForeign.Text = project.RegisteredForeign.ToString();
                try
                {
                    string strSql = "select deptname from dbo.fip_sys_department where oid ='" + project.ResponsibleUnits + "'";
                    this.lblResponsibleUnits.Text = cc.ExecScalar(strSql).ToString();//责任单位
                    BindNameList(this.lblResponsibleUnits.Text, this.ddlResponsiblePersonal);//责人任
                }
                catch (Exception)
                {
                    throw;
                }
                if (SearchOidByName(project.ResponsiblePersonal) != "")
                {
                    this.ddlResponsiblePersonal.SelectedValue = SearchOidByName(project.ResponsiblePersonal);//责任人
                }
                this.txtsbuser.Text = project.APersonal;
                this.txtsbdate.Text = project.ATime.ToString();
                this.txtdept.Text = project.ADept;

                if (!string.IsNullOrEmpty(project.Partner.ToString()))
                {
                    this.ddlPartnerUnit.SelectedValue = project.PartnerUnit.ToString();//合作单位
                }
                if (!string.IsNullOrEmpty(SearchOidByName(project.Partner)))
                {
                    this.ddlPartner.SelectedValue = SearchOidByName(project.Partner);//合作人
                }
                this.txtDistricts.Text = project.Districts;
                this.ddlStatus.Text = project.ProgramStatus;

                this.txtProgressCase.Text = project.ProgressCase;
                this.TxtFileNameList.Text = project.fjname;
                this.TxtFilePath.Text = project.fjpath;
                WebHelper.setLinkB(this.lblLink, this.TxtFileNameList, this.TxtFilePath, "w");
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','0')</script>");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','1')</script>");
        }
        catch (Exception ex)
        {
            this.lbResults.Text = "数据获取错误!" + ex.Message;
        }
    }
    private string SearchOidByName(string name)
    {
        if (!string.IsNullOrEmpty(name))
        {
            string strSql = @"select * from (select  a.oid  from dbo.fip_sys_user a left join dbo.fip_sys_deptusers b
                  on a.oid=b.uid left join dbo.fip_sys_department c on b.did=c.oid left join aspnet_Membership d
                   on a.oid=d.userid where name='" + name + "') newtb";
            cc = new CommonComponent();
            return cc.ExecScalar(strSql).ToString(); ;
        }
        return "";
    }
    //用户验证
    private bool UserValidate(out string strErr)
    {
        strErr = "";
        if (this.txtProjectName.Text == "")
        {
            strErr = "项目名称不能为空!";
            return false;
        }
        if (this.txtProgressCase.Text.Length > 100)
        {
            strErr = "\"进展情况\"请不要超过100个字(含标点符号)!";
            return false;
        }
        return true;
    }

    //审核图标点击事件
    protected void IBbmyj1_Click(object sender, ImageClickEventArgs e)
    {
        if (this.WorkFlowWUC1.CbUnWriteState.Checked != true)
        {
            this.sTbxblr.Text = Me.name;
            this.sTbxblsj.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            this.sTbxbcyj.Text = "已阅";
            this.WorkFlowWUC1.UnWriteState = true;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','0')</script>");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','1')</script>");
        }
    }

    //提交保存
    private void CmdSave_Click(object sender, EventArgs e)
    {
        try
        {
            string errstr = "";
            if (this.UserValidate(out errstr))
            {
                cc = new CommonComponent();
                project = new Pro_ProjectBaseInfo();
                project.ProjectName = this.txtProjectName.Text.Trim();
                project.InfoType = this.ddlInfoType.SelectedItem.Text.Trim();
                project.IsImportance = Convert.ToBoolean(this.rbtnImportance.SelectedValue);
                project.ProgramStatus = this.ddlStatus.SelectedItem.Text.Trim();
                project.Years = this.ddlYear.SelectedItem.Text.Trim();
                project.Months = this.ddlMonth.SelectedItem.Text.Trim();
                project.Industry = this.ddlIndustry.SelectedItem.Text.Trim();
                if (!string.IsNullOrEmpty(this.txtTotalInvestment.Text))
                {
                    project.TotalInvestment = Decimal.Parse(this.txtTotalInvestment.Text.Trim());
                }
                if (!string.IsNullOrEmpty(this.txtRegisteredForeign.Text))
                {
                    project.RegisteredForeign = Decimal.Parse(this.txtRegisteredForeign.Text.Trim());
                }
                if (!string.IsNullOrEmpty(this.txtRegisteredCapital.Text))
                {
                    project.RegisteredCapital = Decimal.Parse(this.txtRegisteredCapital.Text.Trim());
                }
                project.ProgressStatus = "";
                if (project.ProgressCase != "(请输入100字以内字符)")
                {
                    project.ProgressCase = this.txtProgressCase.Text.Trim();
                }
                project.Districts = txtDistricts.Text.Trim();
                string strSql = "select oid from dbo.fip_sys_department where deptName='" + this.lblResponsibleUnits.Text + "'";
                project.ResponsibleUnits = new Guid(cc.ExecScalar(strSql).ToString());
                if (this.ddlPartnerUnit.Text != "---请选择---")
                {
                    project.PartnerUnit = new Guid(this.ddlPartnerUnit.SelectedValue.ToString());
                }
                if (this.ddlResponsiblePersonal.Text != "---请选择---")
                {
                    project.ResponsiblePersonal = this.ddlResponsiblePersonal.SelectedItem.Text;
                }
                if (this.ddlPartner.Text != "---请选择---")
                {
                    project.Partner = this.ddlPartner.SelectedItem.Text.Trim();
                }
                project.ADept = txtdept.Text.Trim();
                project.APersonal = txtsbuser.Text.Trim();
                project.ATime = DateTime.Parse(txtsbdate.Text.Trim());
                project.fjpath = this.TxtFilePath.Text.TrimStart(';').TrimEnd(';');
                project.fjname = this.TxtFileNameList.Text.TrimStart(';').TrimEnd(';');
                if (this.textstrbz.Text == "1")
                {
                    project.hegao = SaveApprove();
                }
                else
                {
                    if (ViewState["hegaoyj"] != null && ViewState["hegaoyj"] != "")
                    {
                        project.hegao = ViewState["hegaoyj"].ToString();
                    }
                    else
                    {
                        project.hegao = "";
                    }
                }
                if ("add".Equals(Request.QueryString["mopentype"]))
                {
                    project.OID = Guid.NewGuid();
                    project.Status = EntityStatus.eAdd;
                }
                else
                {
                    project.OID = new Guid(this.TxtOid.Text.Trim());
                    project.Status = EntityStatus.eUpdate;
                    #region  向项目报表插入或修改数据
                    if (this.WorkFlowWUC1.StepBH == "4")
                    {
                        string str = "select * from dbo.Pro_Rep_ProjectBaseInfo where OID='" + this.TxtOid.Text.Trim() + "'";
                        DataTable dt = cc.RetrieveTable(str);
                        if (dt.Rows.Count > 0)
                        {
                            string strUpdateRep = "UPDATE [FinIport_XBSWJ].[dbo].[Pro_Rep_ProjectBaseInfo]"
                                + "SET [ProjectName] = '" + project.ProjectName + "'"
                                + ",[InfoType] = '" + project.InfoType + "'"
                                + ",[IsImportance] = '" + project.IsImportance + "'"
                                + ",[ProgramStatus] = '" + project.ProgramStatus + "'"
                                + ",[Years] = '" + project.Years + "'"
                                + ",[Months] = '" + project.Months + "'"
                                + ",[Industry] = '" + project.Industry + "'"
                                + ",[TotalInvestment] = '" + project.TotalInvestment + "'"
                                + ",[RegisteredForeign] = '" + project.RegisteredForeign + "'"
                                + ",[RegisteredCapital] = '" + project.RegisteredCapital + "'"
                                + ",[InvestmentChina] = ''"
                                + ",[InvestmentForeign] = ''"
                                + ",[ProgressCase] = '" + project.ProgressCase + "'"
                                + ",[Districts] = '" + project.Districts + "'"
                                + ",[PartnerUnit] = '" + project.PartnerUnit + "'"
                                + ",[Partner] = '" + project.Partner + "'"
                                + ",[ResponsibleUnits] = '" + project.ResponsibleUnits + "'"
                                + ",[ResponsiblePersonal] = '" + project.ResponsiblePersonal + "'"
                                + ",[ATime] = '" + project.ATime + "'"
                                + "WHERE [OID] ='" + this.TxtOid.Text.Trim() + "'";
                            cc.ExecNonQuery(strUpdateRep);
                        }
                        else
                        {
                            string strInsertRep = "INSERT INTO [FinIport_XBSWJ].[dbo].[Pro_Rep_ProjectBaseInfo]([OID],[ProjectName],[InfoType],[IsImportance],[ProgramStatus],[Years],[Months],[Industry],[TotalInvestment],[RegisteredForeign],[RegisteredCapital],[InvestmentChina],[InvestmentForeign],[ProgressCase],[Districts],[PartnerUnit],[Partner],[ResponsibleUnits],[ResponsiblePersonal],[ATime])"
                            + "VALUES" +
                            "('" + this.TxtOid.Text.Trim() + "' ,'" + project.ProjectName + "','" + project.InfoType + "','" + project.IsImportance + "','" + project.ProgramStatus + "','" + project.Years + "','" + project.Months + "','" + project.Industry + "','" + project.TotalInvestment + "','" + project.RegisteredForeign + "','" + project.RegisteredCapital + "',' ',' ','" + project.ProgressCase + "','" + project.Districts + "','" + project.PartnerUnit + "','" + project.Partner + "','" + project.ResponsibleUnits + "','" + project.ResponsiblePersonal + "','" + project.ATime + "')";
                            cc.ExecNonQuery(strInsertRep);
                        }
                    }
                    #endregion
                }
                Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('save','" + project.OID + "','','0')</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('save','" + project.OID + "','','1')</script>");
                string appindex = project.OID.ToString();
                string apptopic = project.ProjectName;
                string appelse = project.OID.ToString();
                this.WorkFlowWUC1.WorkFlowSave(project, appindex, apptopic, appelse);
                if (Request.QueryString["tabid"] != null)
                {
                    string id = Request.QueryString["tabid"].ToString();
                    string url = Server.UrlDecode(Request.QueryString["url"].ToString());
                    int k = url.IndexOf("tabid=t");
                    if (k > 0)
                    {
                        WebHelper.ClientScriptFactoryHelper.RegisterScript("parent.CloseLightBoxNewBill();parent.refreshTab('" + id + "','" + Server.UrlDecode(Request.QueryString["url"].ToString()) + "&page=" + Request.QueryString["page"] + "');");
                    }
                    else
                    {
                        WebHelper.ClientScriptFactoryHelper.RegisterScript("parent.CloseLightBoxNewBill();parent.refreshTab('" + id + "','" + Server.UrlDecode(Request.QueryString["url"].ToString()) + "&tabid=" + id + "&page=" + Request.QueryString["page"] + "');");
                    }
                }
                else
                {
                    WebHelper.ClientScriptFactoryHelper.RegisterScript(WebHelper.ClientScriptFactoryHelper.RefreshParent() + ";" + WebHelper.ClientScriptFactoryHelper.CloseSelf());
                }
            }
            else
            {
                throw new Exception(errstr);
            }
        }
        catch (Exception ex)
        {
            this.lbResults.Text = "数据获取错误!" + ex.Message;
        }
        Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','0')</script>");
        Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','1')</script>");
    }

    //提交进行流程流转
    private void CmdSubmit_Click(object sender, EventArgs e)
    {
        string strErr = "";
        try
        {
            if (this.UserValidate(out strErr))
            {
                this.WorkFlowWUC1.DoAction();
                this.textstrbz.Text = "1";
            }
        }
        catch (Exception ex)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "key", "<script>alert('提交失败!" + ex.Message + "')</script>");
        }
        Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','0')</script>");
        Page.ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>getData('load','" + this.TxtOid.Text + "','','1')</script>");
    }
    //封装审核情况XML
    private string SaveApprove()
    {
        string strxml = ViewState["hegaoyj"] == null ? "" : ViewState["hegaoyj"].ToString().Trim();
        DataTable dt = GetNewTable(strxml);
        string s = "";
        DataRow dr = dt.NewRow();
        dr["stepbh"] = this.WorkFlowWUC1.StepBH;
        dr["stepname"] = this.WorkFlowWUC1.StepName;
        dr["name"] = sTbxblr.Text != null && sTbxblr.Text != "" ? sTbxblr.Text.Trim() : PageBase.CurrentUser.name;
        if (sTbxbcyj.Text.Trim() != null && sTbxbcyj.Text.Trim() != "")
        {
            dr["yj"] = sTbxbcyj.Text.Trim();
        }
        else
        {
            dr["yj"] = "阅";
        }
        if (this.WorkFlowWUC1.StepBH == "1" || this.WorkFlowWUC1.StepBH == "4")
        {
            dr["yj"] = "";
        }
        dr["time"] = sTbxblsj.Text != null && sTbxblsj.Text != "" ? sTbxblsj.Text.Trim() : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        dt.Rows.Add(dr);
        dt.AcceptChanges();
        if (dt.Rows.Count > 0)
        {
            System.IO.MemoryStream ms1 = new MemoryStream();
            dt.WriteXml(ms1, false);
            ms1.Position = 0;
            StreamReader sr = new StreamReader(ms1);
            s = sr.ReadToEnd();
            ViewState["hegaoyj"] = s;
        }
        return s;
    }

    //加载审核情况XML
    private void ProcessApprove(string xmlContent)
    {
        if (!string.IsNullOrEmpty(xmlContent))
        {
            if (xmlContent != " ")
            {
                DataTable dt = GetNewTable(xmlContent);
                DataView dv = dt.DefaultView;
                dv.Sort = "time asc "; // 按办理时间排列
                for (int i = 0; i < dv.Count; i++)
                {
                    strLDPS += "<tr>";
                    strLDPS += "<td style=\"text-align: center;\">" + dv[i]["stepbh"].ToString() + "</td>";
                    strLDPS += "<td style=\"text-align: center;\">" + dv[i]["stepname"].ToString() + "</td>";
                    strLDPS += "<td style=\"text-align: center;\">" + dv[i]["name"].ToString() + "</td>";
                    strLDPS += "<td style=\"text-align: center;\">" + dv[i]["time"] + "</td>";
                    strLDPS += "<td style=\"text-align: center;\">" + dv[i]["yj"].ToString() + "</td>";
                    strLDPS += "</tr>";
                    //strLDPS += dv[i]["name"].ToString() + " [" + dv[i]["time"] + "]:" + dv[i]["yj"].ToString() + "<br/>";
                }
            }
            else
            {
                strLDPS = "";
            }
        }
    }

    /// <summary>
    /// 产生一个架构的数据表
    /// </summary>
    /// <param name="strXml"></param>
    /// <returns></returns>
    private DataTable GetNewTable(string strXml)
    {
        DataTable result = new DataTable();
        XmlDocument xdoc = new XmlDocument();
        DataSet ds = new DataSet();
        if (strXml != "")
        {
            xdoc.LoadXml(strXml);
        }
        else
        {
            xdoc.LoadXml("<NewDataSet><yjs><stepbh/><stepname/><name/><yj/><time/></yjs></NewDataSet>");
        }
        System.Xml.XmlNodeReader xmlrd = new XmlNodeReader(xdoc.SelectSingleNode("//NewDataSet"));
        if (xmlrd != null)
        {
            ds.ReadXml((XmlReader)xmlrd);
            result = ds.Tables[0];
            if (strXml == "")
                result.Rows.Clear();
        }
        return result;
    }

    /// <summary>
    /// 产生一个架构的数据表
    /// </summary>
    /// <param name="strXml"></param>
    /// <returns></returns>
    private DataTable GetNewScheduleTable(string strXml)
    {
        DataTable result = new DataTable();
        XmlDocument xdoc = new XmlDocument();
        DataSet ds = new DataSet();
        if (strXml != "")
        {
            xdoc.LoadXml(strXml);
        }
        else
        {
            xdoc.LoadXml("<NewDataSet><yjs><description/><name/><time/></yjs></NewDataSet>");
        }
        System.Xml.XmlNodeReader xmlrd = new XmlNodeReader(xdoc.SelectSingleNode("//NewDataSet"));
        if (xmlrd != null)
        {
            ds.ReadXml((XmlReader)xmlrd);
            result = ds.Tables[0];
            if (strXml == "")
                result.Rows.Clear();
        }
        return result;
    }
}

posted @ 2012-12-28 10:58  Taffy++  阅读(425)  评论(0编辑  收藏  举报