假设你的后台类及类中的方法是:
public class MyDropdownList
    {
        public static void Add(DropDownList DropDownList1)
        {
            DropDownList1.Items.Add(new ListItem("老师"));
            DropDownList1.Items.Add(new ListItem("学生"));
        }
    }
那么你就可以在aspx的Form_Load事件中加上:
 MyDropdownList.Add(this.DropDownList1);

解决方案 »

  1.   

     没有问题阿,网页显示正常,是不是有其它代码错误阿
     protected void Page_Load(object sender, EventArgs e)
            {
                this.DropDownList1.Items.Add(new ListItem("老师"));
                this.DropDownList1.Items.Add(new ListItem("学生"));
            }
      

  2.   

    protected void Page_Load(object sender, EventArgs e)        
            {
                if (!IsPostBack)
                {
                    this.DropDownList1.Items.Add(new ListItem("老师"));
                    this.DropDownList1.Items.Add(new ListItem("学生"));
                }        }