c#下拉框绑定后台数据

前台代码:


后台代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;

namespace admin
{
public partial class news_Editor : System.Web.UI.Page
{
public StringBuilder list = new StringBuilder();
public string bId = "3";//大类ID
protected void Page_Load(object sender, EventArgs e)
{
//查询新闻类型
Date();
}
public void Date()
{
DataTable dt = sqlhelper.publicFun("select * from tb_sonType where type_Id=" + bId);
if (dt != null)
{
foreach (DataRow dr in dt.Rows)
{
list.Append(" ");
}
}
}
}
}
效果图:

c#下拉框绑定后台数据_第1张图片
image.png

你可能感兴趣的:(c#下拉框绑定后台数据)