edititemtemplate中的dropdownlist有原始数据,想在编辑状态时显示数据库中绑定数据! 同上! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 this.DataGrid1.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DataGrid1_ItemDataBound);private void DataGrid1_ItemDataBound(object sender,DataGridItemEventArgs args) { if(args.Item.ItemType == ListItemType.EditItem) { DropDownList DropGroupID1 = (DropDownList)args.Item.FindControl("DropGroupID"); if(DropGroupID1 != null) { SqlConnection conn = new SqlConnection(Global.ConnectionString); conn.Open(); SqlCommand cmd = new SqlCommand("select tmpUID,tmpName from tmpFlag",conn); SqlDataAdapter da = new SqlDataAdapter(cmd); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); DropGroupID1.DataSource = dr; DropGroupID1.DataValueField = "tmpUID"; DropGroupID1.DataTextField = "tmpName"; DropGroupID1.DataBind(); dr.Close(); string asdd= ((Label)args.Item.FindControl("Label1")).Text; DropGroupID1.Items.FindByValue(asdd).Selected = true; } } } 如何将自定义的表更新到数据库中?? 这样写面向对象有问题吗? 关于下载的一个问题 一个有些难度的问题 ,come on ,一起谈论一下 关于REPEATER控件 新数据可以更新,老数据不能更新,知道为什么??急!!!!!!!!!!1 求教 怎样弹出一个窗口,并且让背景变为灰色?是不是要用到AJAX中的ModalPopupExtender控件,如果要用到,那怎么用? 急需求教:怎么样在asp.net里面调出word文档? 请高手回答,datagrid问题!等候ing…… 树节点怎么连续的选择? 關於Asp.net彈出對話框的問題
{
if(args.Item.ItemType == ListItemType.EditItem)
{
DropDownList DropGroupID1 = (DropDownList)args.Item.FindControl("DropGroupID");
if(DropGroupID1 != null)
{
SqlConnection conn = new SqlConnection(Global.ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("select tmpUID,tmpName from tmpFlag",conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
DropGroupID1.DataSource = dr;
DropGroupID1.DataValueField = "tmpUID";
DropGroupID1.DataTextField = "tmpName";
DropGroupID1.DataBind();
dr.Close();
string asdd= ((Label)args.Item.FindControl("Label1")).Text;
DropGroupID1.Items.FindByValue(asdd).Selected = true;
}
}
}