<%@ page language="C#" autoeventwireup="true" inherits="Admin_Admin_AdminDropDownListEdit, App_Web_ahimsrpm" %>

<html>
<head runat="server">
    <title>编辑系统下拉选框</title>
    <link type="text/css" href="css/style.css" rel="stylesheet" />
    <link type="text/css" href="../css/Admin.css" rel="stylesheet" />
    <style type="text/css">
        input
        {
	        width:60%;
	        margin-left:10px;
        }
        #tbl_items tr{
             height:30px;
        } 
    </style>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div class="tips">
                下拉选框编辑，编辑系统中所有的下拉选框。
            </div>
            <table class="main">
                <tr style="display:none;">
                    <td style="width: 100px">
                        编 &nbsp; &nbsp;&nbsp; 号</td>
                    <td style="width: 700px; text-align: left;">
                        <Ws:TextBox ID="txt_ID" runat="server" Width="50px" ValidNull="False" ValidType="BigIntPostive"></Ws:TextBox></td>
                </tr>
                <tr>
                    <td style="width: 100px">
                        唯一名称</td>
                    <td style="width: 700px; text-align: left;">
                        <Ws:TextBox ID="txt_ConstName" runat="server" Width="250px" ValidNull="False" ValidType="EngNumUnLine"></Ws:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="width: 100px">
                        名 &nbsp; &nbsp;&nbsp; 称</td>
                    <td style="width: 700px; text-align: left;">
                        <Ws:TextBox ID="txt_ChinaName" runat="server" Width="250px" ValidNull="False" ValidType="Str"></Ws:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="width: 100px">
                        备 &nbsp; &nbsp;&nbsp; 注</td>
                    <td style="width: 700px; text-align: left;">
                        <Ws:TextBox ID="txt_Remark" runat="server" Width="250px" TextMode="MultiLine"></Ws:TextBox>
                    </td>
                </tr>
                <tr class="noStyle">
                    <td style="width: 100px">
                        选 &nbsp; &nbsp;&nbsp; 项</td>
                    <td style="width: 700px">
                        <table style="width: 700px; border-width:0px;"  runat="server" id="tbl_items" enableviewstate="true">
                            <thead>
                                <tr>
                                    <td style="width: 300px">
                                        文本</td>
                                    <td style="width: 200px">
                                        值</td>
                                    <td style="width: 100px">
                                        排序</td>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 300px">
                                        <input name="txt_Item_name" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                    <td style="width: 200px">
                                        <input name="txt_Item_Value" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:150px;" />
                                    </td>
                                    <td style="width: 100px">
                                        <input name="txt_Item_Index" type="text" value="" class="InputBlur" onfocus="this.className='InputFocus';" onblur="this.className='InputBlur';" style="width:250px;" />
                                    </td>
                                </tr>
                                
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="2" style="width: 800px">
                        <Ws:Button ID="btn_Save" runat="server" Styles="WebButton"  Format-Value="正在处理，请稍候..." Type="Wait" OnClick="btn_Save_Click" CausesValidation="False" />&nbsp;<input
                            id="btn_AddRow" type="button" value="添加行" class="ButtonBlur" />
                        <Ws:Button ID="btn_return" runat="server" Text=" 返  回 " Type="OkChangUrlOrCancel" Format-Value="返回后，您未保存的信息将丢失，<br />确定要返回吗？" Format-SrcOk="Admin_AdminDropDownList.aspx" CausesValidation="False" UseSubmitBehavior="False" />&nbsp;
                    </td>
                </tr>
            </table>
        </div>
    </form>
        <script type="text/javascript">
        $(function(){
        
            addTenRows();
            
           for(var i=0;i<$("input[name='txt_Item_name']").size();i++)
           {
              $("input[name='txt_Item_name']").eq(i).val(name[i]);
           } 
           
           for(var i=0;i<$("input[name='txt_Item_Value']").size();i++)
           {
            $("input[name='txt_Item_Value']").eq(i).val(i+1);
           }
            for(var i=0;i<$("input[name='txt_Item_Index']").size();i++)
           {
            $("input[name='txt_Item_Index']").eq(i).val(i);
           }
           
           $("#btn_AddRow").click(function ()
           {
                AddRow();
           });
           
           
           
        })
        
        function addTenRows()
        {
           if (name.length>$("input[name='txt_Item_name']").size())
           {
                for(var i=0;i<10;i++)
                {
                    AddRow();
                }
           }
           if (name.length>$("input[name='txt_Item_name']").size())
           {
            addTenRows();
           }
           
        }
        
        function AddRow()
        {
    	    var maxValue=0;
            $("input[name='txt_Item_Value']").each(function ()
            {
                
            	if(parseInt($(this).val())>maxValue)
            	{
            	    maxValue=parseInt($(this).val());
            	}
            	
            });
            maxValue+=1;
       	    $("#tbl_items tbody").append("<tr><td style=\"width: 300px\"><input name=\"txt_Item_name\" type=\"text\" value=\"\" class=\"InputBlur\" onfocus=\"this.className='InputFocus';\" onblur=\"this.className='InputBlur';\" style=\"width:250px;\" /></td><td style=\"width: 200px\"><input name=\"txt_Item_Value\" type=\"text\" value=\""+ maxValue.toString() +"\" class=\"InputBlur\" onfocus=\"this.className='InputFocus';\" onblur=\"this.className='InputBlur';\" style=\"width:150px;\" /></td><td style=\"width: 100px\"><input name=\"txt_Item_Index\" type=\"text\" value=\""+ (maxValue-1).toString() +"\" class=\"InputBlur\" onfocus=\"this.className='InputFocus';\" onblur=\"this.className='InputBlur';\" style=\"width:250px;\" /></td></tr>");

        }
    </script>
</body>
</html>
