如题

解决方案 »

  1.   

    你是用在JS里边还是用哪啊???
    js里边可以用啊。
      

  2.   

    var selectList = {
        s1:$("#se1"),
        s2:$("#se2")
        ...
    };
    json格式想怎么放就怎么放
      

  3.   

            #region 选中DropDownList中指定的项
            /// <summary>
            /// 选中DropDownList中指定的项
            /// </summary>
            /// <param name="ddl"></param>
            /// <param name="itemValue"></param>
            public void SelectOneItemByValue(DropDownList ddl, string itemValue)
            {
                if (ddl == null)
                    return;            if (ddl.Items.Count == 0)
                    return;            foreach (ListItem item in ddl.Items)
                {
                    item.Selected = false;
                }// end foreach            foreach (ListItem item in ddl.Items)
                {
                    if (itemValue == item.Value)
                    {
                        item.Selected = true;
                        break;
                    }// end if
                }// end foreach        }
    我有这么个方法啊,把select控件放进去,提示报错啊  无效参数
      

  4.   

    没有明白你到底想怎么使用select id='select1' 的?
    具体点.
      

  5.   

    select id=''select1''嗯 这是id
      

  6.   

    select id=''select1''嗯 这是id 整解
      

  7.   

    你这想干什么啊?SelectOneItemByValue
      

  8.   

    public void fun(object obj){}  表示 任何对象都可以成为参数
    在 C# 的统一类型系统中,所有类型(预定义类型、用户定义类型、引用类型和值类型)都是直接或间接从 Object 继承的
      

  9.   

    我是想写个方法,让select控件选中我指定的项
    代码
    public void SelectOneItemByValue(DropDownList ddl, string itemValue)
      {
      if (ddl == null)
      return;  if (ddl.Items.Count == 0)
      return;  foreach (ListItem item in ddl.Items)
      {
      item.Selected = false;
      }// end foreach  foreach (ListItem item in ddl.Items)
      {
      if (itemValue == item.Value)
      {
      item.Selected = true;
      break;
      }// end if
      }// end foreach  }
    这个方法可以让DropDownList 选中指定项,就是如何把DropDownList 这个参数改成select控件id