WorkFlowSelectTable.aspx
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:8k
源码类别:

.net编程

开发平台:

C#

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="WorkFlowSelectTable.aspx.cs" Inherits="Workflow_WorkFlowSelectTable" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head runat="server">
  5.     <link href="style/formbody.css" rel="stylesheet" type="text/css" />
  6.     <base target="_self" />
  7.     <title>关联表单选择</title>
  8.     <script language="javascript" type="text/javascript">
  9. <!--
  10. function AddItem (ListBox2Object,ListBox1Object) //添加指定项
  11. {
  12.      var selIndex=ListBox1Object.selectedIndex; //选定行的索引
  13.  if(selIndex==-1)
  14.         alert("请选择一项");
  15. else
  16. {
  17.     var strText=ListBox1Object.options[selIndex].text;
  18.     var strValue=ListBox1Object.options[selIndex].value;
  19.     for(i=0;i < ListBox2Object.options.length;i++)
  20.       {
  21.         if(strText==ListBox2Object.options[i].text || strValue==ListBox2Object.options[i].value)
  22.         {
  23.             alert("不可添加重复的项!");
  24.             return;
  25.         }
  26.        }  
  27.     var oItem=document.createElement("option");
  28.     oItem.text=strText;
  29.     oItem.value=strValue;
  30.     ListBox2Object.add(oItem);
  31.        var UserRoleText=document.getElementById("TB_UserRole").innerText;
  32.        var RoleIDValue=document.getElementById("txt_RoleID").innerText;
  33.         for(i=0;i<ListBox2Object.options.length;i++)
  34.          { 
  35.              var strText=ListBox2Object.options[i].text;
  36.              var strValue=ListBox2Object.options[i].value;
  37.              UserRoleText=UserRoleText + strText + ",";
  38.              RoleIDValue=RoleIDValue + strValue + ",";
  39.          }
  40.        document.getElementById("TB_UserRole").innerText=UserRoleText;
  41.        document.getElementById("txt_RoleID").innerText=RoleIDValue;
  42.   
  43.    }
  44.  
  45. }
  46. function  AddItemAll(ListBox2Object,ListBox1Object)//添加全部
  47. {
  48.    document.getElementById("txt_RoleID").innerText="";
  49.    document.getElementById("TB_UserRole").innerText="";
  50.   for(i=ListBox2Object.options.length-1;i>=0;i--)
  51.    { 
  52.       ListBox2Object.options.remove(i);
  53.       
  54.    }
  55.    var UserRoleText=document.getElementById("TB_UserRole").innerText;
  56.    var RoleIDValue=document.getElementById("txt_RoleID").innerText;
  57. //   alert(ListBox1Object.options.length);
  58.   for(i=0;i<ListBox1Object.options.length;i++)
  59.     { 
  60.          var strText=ListBox1Object.options[i].text;
  61.          var strValue=ListBox1Object.options[i].value;
  62.          ListBox2Object.options.add(new Option(strText,strValue));
  63.         UserRoleText=UserRoleText + strText + ",";
  64.         RoleIDValue=RoleIDValue + strValue + ",";
  65.     }
  66.     document.getElementById("TB_UserRole").innerText=UserRoleText;
  67.     document.getElementById("txt_RoleID").innerText=RoleIDValue;
  68.     
  69. }
  70. function DelItem(ListBox2Object)  //删除指定项
  71. {
  72.  var selIndex=ListBox2Object.selectedIndex;
  73.  if(selIndex==-1)
  74.      alert("请选择一项后再删除!");
  75.    else  
  76.      {
  77.        var RoleTexxt= ListBox2Object.options[selIndex].text;
  78.        ListBox2Object.options.remove(selIndex);
  79.        var  str= document.getElementById("txt_RoleID").innerText;
  80.        
  81.         var UserRoleText=document.getElementById("TB_UserRole").innerText;
  82.        var RoleIDValue=document.getElementById("txt_RoleID").innerText;
  83.         for(i=0;i<ListBox2Object.options.length;i++)
  84.          { 
  85.              var strText=ListBox2Object.options[i].text;
  86.              var strValue=ListBox2Object.options[i].value;
  87.              UserRoleText=UserRoleText + strText + ",";
  88.              RoleIDValue=RoleIDValue + strValue + ",";
  89.          }
  90.        document.getElementById("TB_UserRole").innerText=UserRoleText;
  91.        document.getElementById("txt_RoleID").innerText=RoleIDValue;
  92.      }
  93. }
  94. function  DelAllItem(ListBox2Object)  //删除全部
  95. {
  96.  var rows=ListBox2Object.options.length;
  97.  for(i=rows-1;i>=0;i--)
  98.    { 
  99.       ListBox2Object.options.remove(i);
  100.      
  101.    }
  102.      document.getElementById("txt_RoleID").innerText="";
  103.      document.getElementById("TB_UserRole").innerText="";
  104. if(rows==0)
  105.   alert("已全部删除!");
  106. }
  107.     function modelesswin(url,mwidth,mheight)
  108.      { 
  109.       var a=new  Array(2);
  110.        if (document.all&&window.print) 
  111.         { var re= window.showModalDialog(url,"","help:0;dialogWidth=350px;dialogHeight=400px,status=no;scroll=no;");
  112.          }
  113.          if (re!=undefined) 
  114.          {
  115.           a= re.split(',');
  116.           document.getElementById("TB_employe").innerText=a[1];
  117.           document.getElementById("txt_employeid").innerText=a[0];
  118.         }
  119.    }
  120.    
  121. // -->
  122. </script>
  123. </head>
  124. <body>
  125.     <form id="form1" runat="server">
  126.     <div>
  127.         <table cellspacing="0" cellpadding="0" width="400" border="0">
  128. <tr>
  129. <td style="width:5; height:5;"></td>
  130. <td></td>
  131. <td style="width:5"></td>
  132. </tr>
  133. <tr>
  134. <td></td>
  135. <td>
  136. <fieldset><legend>请选择</legend>
  137. <table cellspacing="0" cellpadding="0" width="400" border="0">
  138. <tr>
  139. <td style="width:10;height:10" ></td>
  140. <td style="width:150"></td>
  141. <td style="width:10"></td>
  142. <td style="width:60"></td>
  143. <td style="width:10"></td>
  144. <td style="width:150"></td>
  145. <td style="width:10"></td>
  146. </tr>
  147. <tr>
  148. <td style="height:200"></td>
  149. <td><asp:listbox id="lbTable" runat="server" Height="200px" Width="160px" SelectionMode="Multiple"
  150. CssClass="input"></asp:listbox></td>
  151. <td></td>
  152. <td>
  153. <table cellspacing="0" cellpadding="0" width="100%" border="0">
  154. <tr align="center">
  155. <td align="center">
  156. <input type="hidden" id="TB_UserRole" name="TB_UserRole" runat="server"/>
  157. <input type="hidden" id="txt_RoleID" name="txt_RoleID" runat="server"/>
  158.                                             <input id="BT_AddAll" type="button" runat="server" style="width:75px;" value="添加全部>>" onclick="javascript:AddItemAll(body.all.lbTableSelected,body.all.lbTable)"/><br/> 
  159.                                             <input id="BT_AddOne" type="button" runat="server" style="width:75px;" value="添加>" onclick="javascript:AddItem(body.all.lbTableSelected,body.all.lbTable)" /><br/>
  160.                                             <input id="BT_DelOne" type="button" runat="server" style="width:75px;" value="<删除" onclick="javascript:DelItem(body.all.lbTableSelected)" /><br/>
  161.                                             <input id="BT_DelAll" type="button" runat="server" style="width:75px;" value="<<删除全部" onclick="javascript:DelAllItem(body.all.lbTableSelected)" />
  162.                                             </td>
  163. </tr>
  164. </table>
  165. </td>
  166. <td></td>
  167. <td><asp:listbox id="lbTableSelected" runat="server" Height="200px" Width="160px" SelectionMode="Multiple"
  168. CssClass="input"></asp:listbox></td>
  169. <td></td>
  170. </tr>
  171. <tr>
  172. <td style="height:10"></td>
  173. <td></td>
  174. <td></td>
  175. <td></td>
  176. <td></td>
  177. <td></td>
  178. <td></td>
  179. </tr>
  180. </table>
  181. </fieldset>
  182. <table cellspacing="0" cellpadding="0" width="400" border="0">
  183. <tr>
  184. <td colspan="2" style="height:10"></td>
  185. </tr>
  186. <tr>
  187. <td align="center">
  188. <asp:ImageButton id="ImageButton1" runat="server" ImageUrl="image/confirm.gif" OnClick="ImageButton1_Click"></asp:ImageButton></td>
  189. <td align="center">
  190. <asp:ImageButton id="ImageButton2" runat="server" ImageUrl="image/cancel.gif" OnClientClick="javascript:if(confirm('系统提示:您确定退出选择吗?')) window.close();"></asp:ImageButton></td>
  191. </tr>
  192. </table>
  193. </td>
  194. <td></td>
  195. </tr>
  196. <tr>
  197. <td style="height:5;"></td>
  198. <td></td>
  199. <td></td>
  200. </tr>
  201. </table>
  202.     </div>
  203.     </form>
  204. </body>
  205. </html>