网站后台管理之数据列表绑定、删除和修改(19)
发布时间:2021-06-07
发布时间:2021-06-07
DropDownList1.Items.FindByValue(articleModel.articleTypeId.ToString().Trim()).Selected = true ; txtTitle.Text = articleModel.articleTitle;
FCKeditor1.Value = articleModel.articleContent.Trim(); if (articleModel.articleState == 1)//获取复选框选择结果 {
CheckBox1.Checked = true; } else {
CheckBox1.Checked = false ; } } } }
/// <summary> /// 绑定文章类型数据 /// </summary>
public void BindArticleType() {
//定义业务逻辑层中ArticleType类的一个对象
BLL.ArticleType articleTypeBll = new BLL.ArticleType(); DataSet ds = new DataSet();//定义一个数据集对象 //调用类中GetList()的方法 ds = articleTypeBll.GetList("");
DropDownList1.DataSource = ds;//给下拉框赋值数据源 DropDownList1.DataBind();//绑定数据源 }
protected void btnUpdate_Click(object sender, EventArgs e) {
articleModel = articleBll.GetModel(Convert.ToInt32(Id)); articleModel.articleTitle = txtTitle.Text.Trim(); articleModel.articleTime = DateTime.Now;
if (CheckBox1.Checked == true)//获取复选框选择结果 {
articleModel.articleState = 1; } else {
articleModel.articleState = 0; }
articleModel.articleContent = FCKeditor1.Value;
articleModel.articleTypeId = Convert.ToInt32(DropDownList1.SelectedItem.Value);//获取下拉框选择值
bool state = articleBll.Update(articleModel);
上一篇:音频技术与应用发展趋势
下一篇:小学科学课外活动记录表