• 2021-04-14
    如图,是ASP.NET中的一个DropDownList控件,已知该控件的AutoPostBack属性、EnableViewState属性都为True,该控件所在的页面的部分代码如下,在图示状态下,用户单击关羽项后,在页面的输出结果是()。2、ProtectedSystem..Web.UI.WebControls.DropDownListDropDownList1;ProtectedSystem..Web.UI.WebControls.ButtonButton1;stringname=”诸葛亮”;privatevoidPage_load(Objectsender,System.EventArgse){if(!this.IsPostBack){string[]names=newstring[]{“张飞”,”关羽”,”刘备”}this.DropDownList1.DataSource=names;this.DataBind();}}PrivatevoidDropDownList1_SelectedIndexChanged(objectsender,System.EventArgse){If(this.DropDowmList1.SelectedItem!=null){name=this.DropDownList1.SelectedItem.Text;}Response.Write(name)}
  • 举一反三