为什么DropDownList受保护级别限制
E:\ps\zyp\control\post.ascx.cs(48): 不可访问“System.Web.UI.WebControls.ListControl.items”,因为它受保护级别限制private void GetSourceListData()
{//清空DropDownList控件的所有数据项
SoureList.items.Clear();
//创建数据库的连接对象
String cmdText="SECECT powerid,powername from power";
SqlConnection myConnection=new SqlConnection(SQLCONNECTIONSTRING);
SqlCommand myCommand=new SqlCommand(cmdText,myConnection);
myConnection.Open();
SqlDataReader reader=myCommand.ExecuteReader();
while(reader.Read())
{
SoureList.items.Add(new ListItem(reader["prowerid"].ToString(),reader["powername"].ToString()));
}
reader.Close();
myConnection.Close();
}