我有一个DropDown列表,其中我使用代码隐藏从我的数据库中带来的值。我需要一个DropDown值链接到另一个页面
我已经读从源数据,调用后增加了一个新的价值“增加新的技能”。
现在,当用户点击这个项目,我需要一个小页面(或者更确切地说,一个新的页面),打开添加未在DropDownList中提到的技能。
if (!IsPostBack)
{
SqlConnection myConn = new SqlConnection(@"Data Source=USER-PC\SQLEXPRESS;Initial Catalog=KKSTech;Integrated Security=True");
SqlCommand myCmd = new SqlCommand(
"SELECT SkillName, SkillID FROM Skills", myConn);
myConn.Open();
SqlDataReader myReader = myCmd.ExecuteReader();
//Set up the data binding.
DropDownList1.DataSource = myReader;
DropDownList1.DataTextField = "SKillName";
DropDownList1.DataValueField = "SkillID";
DropDownList1.DataBind();
//Close the connection.
myConn.Close();
myReader.Close();
//Add the item at the first position.
DropDownList1.Items.Insert(0, "..Add New Skill");
}
这是我的代码隐藏文件..现在如何链接?
而且你怎么我绑定到该项目中添加链接? ? 其管理员正在添加一名员工的技能,所以当他看到列表中没有技能时,他选择此项目“添加新的”,然后他添加新的技能.. – Girish 2012-07-27 07:30:56