zoukankan      html  css  js  c++  java
  • JS 动态显示 获取下拉框的多个值

     <script type="text/javascript">
            function GetProcessVal(i, t) {
                document.getElementsByName("items[#index#].typeName")[i].value += t.value + ',';
            }
     </script>


    后台代码:

     
    static StringBuilder sbProcessingtype = null;
    
    


    private
    void getProcessingtype()
            {
               
    if (null == sbProcessingtype)
                {
                    sbProcessingtype
    = new StringBuilder();
                   
    string str_Query = "select comoboxText  from  Bs_ComboBoxConfig  where comoboxID='15' order by comoboxValue asc";
                    IList
    <string> list = objComboBoxConfigRepository.ExecuteSQLReturnStr(str_Query);

                    sbProcessingtype.Append(
    "<select  onchange="GetProcessVal({0},this)"   name="items[#index#].Processingtype"  > <option value=""></option>");
                   
    int count = list.Count;
                   
    for (int i = 0; i < count; i++)
                    {
                        sbProcessingtype.Append(
    "<option value="" + list[i] + "">" + list[i] + "</option>");
                    }
                }
            }

    调用 :

     private string BindTable(IList<VOutProceManager> objList, bool isDeleted)
            {
                sbProcessingtype = null;
                getProcessingtype();//调用方法
                string strCalMethod = "";
                StringBuilder sb = new StringBuilder();
                int i = 0;
                string currentdate = DateTime.Now.ToString("yyyy-MM-dd");
                string PriceType = Convert.ToString(base.GetComboBoxConfig(15));
                foreach (VOutProceManager obj in objList)
                {
                    sb.Append("<tr class="unitBox">");
                    if (isDeleted)
                        sb.Append("<td style='30px'  ><a class='btnDel' style='22px' target="ajaxTodo" style="cursor:pointer"  href="outProcessGL/OProcessRequisition/DelMaterialInfo?id=" + obj.Id + "&iscoper=" + obj.Isbom + "" >删除</a></td>");
                    else
                        sb.Append("");
                    sb.Append("<input type="hidden"   name="items[#index#].Id"   submitName="items[" + i + "].Id" value="" + obj.Id + "" /> ");
                    sb.Append("<input type="hidden"   name="items[#index#].bomID"   submitName="items[" + i + "].bomID" value="" + obj.bomID + "" /> ");
                    sb.Append("<input type="hidden"   name="items[#index#].Isbom"   submitName="items[" + i + "].Isbom" value="" + obj.Isbom + "" /> ");
                    sb.Append("<td  ><input class="textInput "   size='15'   readonly="readonly"  value="" + obj.mouldNo + ""  > </td>");
                    sb.Append("<td  ><input class="textInput " size='9'   readonly="readonly" name="items[#index#].partName" submitName="items[" + i + "].partName" value="" + obj.partName + ""  > </td>");
                    sb.Append("<td  ><input class="textInput " size='3'   readonly="readonly" name="items[#index#].drawingNo"  submitName="items[" + i + "].drawingNo"   value="" + obj.drawingNo + ""  > </td>");
                    sb.Append("<td  ><input class="textInput required number" size='9'  name="items[#index#].qty"  submitName="items[" + i + "].qty" value="" + obj.qty + ""  > </td>");
                    sb.Append("<td  ><input class=" textInput  " size='15'    name="items[#index#].typeName"  submitName="items[" + i + "].typeName" value="" + obj.typeName + ""  > ");
                    sb.Append(string.Format(sbProcessingtype.ToString(), i) + " </td>");//调用sbProessingType
                    sb.Append("</tr>");
                    i++;
                }
                return sb.ToString();
            }
  • 相关阅读:
    使用新建项目,引用底层库,运行时提示http://www.xinxizhan.cn/none-authorization.html。无授权解决方法
    treeviewhelper用法,找child的UIElement
    用#FFFF2222的string生成color
    DataTemplate.LoadContent Method将resource中的datatemplate转换为UIElement,可以用于对象添加
    Server.Mappath
    回调函数
    用where进行条件查询
    NPOI用法。
    [转].tostring设置格式。C# tostring 格式化输出
    【转】灵活运用 SQL SERVER FOR XML PATH。用于方便处理生成视图
  • 原文地址:https://www.cnblogs.com/liuwj/p/3421529.html
Copyright © 2011-2022 走看看