復制代碼 代碼如下:
<label>發布欄目:<asp:DropDownList runat="server"></asp:DropDownList></label
復制代碼 代碼如下:
SourceDb DropDwonListData = new SourceDb();
string DropDwonSelect = "SELECT * FROM [Section]";
sectionDropDownList.DataSource = DropDwonListData.DatasetDb(DropDwonSelect).Tables[0].DefaultView;
sectionDropDownList.DataTextField = "name";
sectionDropDownList.DataValueField = "code";
sectionDropDownList.DataBind();
復制代碼 代碼如下:
string newsTitle = sectionDropDownList.SelectedValue;
Response.Write(newsTitle);
復制代碼 代碼如下:
<label>發布欄目:<asp:DropDownList runat="server"></asp:DropDownList></label
復制代碼 代碼如下:
if(!IsPostBack){
SourceDb DropDwonListData
= new SourceDb();
string DropDwonSelect = "SELECT * FROM [Section]";
sectionDropDownList.DataSource = DropDwonListData.DatasetDb(DropDwonSelect).Tables[0].DefaultView;
sectionDropDownList.DataTextField = "name";
sectionDropDownList.DataValueField = "code";
sectionDropDownList.DataBind();
}
復制代碼 代碼如下:
string newsTitle = sectionDropDownList.SelectedValue;
Response.Write(newsTitle);
新聞熱點
疑難解答
圖片精選