DropDownList1.Items.Add( new ListItem("txt" + i.ToString(), "var"+ i.ToString()));

解决方案 »

  1.   

    同意net_lover
    DropDownList1.Items.Add( new ListItem("txt" + i.ToString(), "var"+ i.ToString()));
      

  2.   

    DropDownList dpList=new DropDownList();
    for(int i=0;i<10;i++)
    {
      ListItem li=new ListItem();
      li.Text="..";
       li.value="..";
       dpList.Items.Add(li);
    }
      

  3.   

    DropDownList dpList=new DropDownList();
    for(int i=0;i<10;i++)
    {
      ListItem li=new ListItem();
      li.Text="txt" + i.ToString();
       li.value="var"+ i.ToString();
       dpList.Items.Add(li);
    }