DropDrownList绑定数据后设置默认值

Category.DataSource = b_ProductType.GetAllList().Tables[0];
Category.DataTextField = "TypeName";
Category.DataValueField = "ID";
Category.DataBind();
Category.Items.Insert(0, new ListItem("-请选择-", ""));
//Category.Items.FindByText("-请选择-").Selected = true;
Category.SelectedValue = "-请选择-";(两个效果都一样)

posted @ 2015-03-31 13:22  徐本县  阅读(317)  评论(0编辑  收藏  举报