用Ajax动态绑定数据库的数据:点击后台查看代码,编写代码如下
if (!IsPostBack)
{
using (SnailTechDataContext con = new SnailTechDataContext())
{
DropDownList1.DataSource = con.Job.ToList();
DropDownList1.DataTextField = "JobName";
DropDownList1.DataValueField = "JobCode";
DropDownList1.DataBind();
}
}