listBoxData.Add(new ListItem("Text","Value"));

解决方案 »

  1.   

       ListItemCollection listBoxData = new ListItemCollection();
    for(int u=0;u<MyDataGrid.PageCount;u++)
    {
    listBoxData.Add(new ListItem("第"+(u+1).ToString()+"页",Convert.ToString(u)));
    }
    myDropDownList.DataSource = listBoxData;
        myDropDownList.DataBind();
    为什么还是不行?我的代码如上,执行后,查看源文件,每一个ListItem的值都是第u页,这是怎么回事?
      

  2.   

    获取选择的值:
    myDropDownList.SelectItem.Value获取选择的文本:
    myDropDownList..SelectItem.Text