public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); strWhere.Append(" 1=1 "); if (txtKeyword.Text.Trim() != "") { strWhere.AppendFormat(" and title like '%{0}%'", txtKeyword.Text.Trim()); } ds = bll.GetList(strWhere.ToString() + " order by ID asc"); gridView.DataSource = ds; gridView.DataBind(); }
public void BindData() { gridView1.Visible = false; gridView2.Visible = false; gridView3.Visible = false; gridView4.Visible = false; DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); Model.ed_node model = nBll.GetModel(int.Parse(ddrNode.SelectedValue)); if (model.types.Value == 1) { //新闻 gridView1.Visible = true; strWhere.Append(" status=1"); ds = newsBll.GetList(strWhere.ToString() + " order by addTime desc"); gridView1.DataSource = ds; gridView1.DataBind(); } else if (model.types.Value == 2) { //单页 gridView2.Visible = true; strWhere.Append(" nodeId=" + ddrNode.SelectedValue); ds = pageBll.GetList(strWhere.ToString() + " order by ID desc"); gridView2.DataSource = ds; gridView2.DataBind(); } else if (model.types.Value == 3) { //产品 gridView3.Visible = true; strWhere.Append(" nodeId=" + ddrNode.SelectedValue); ds = proBll.GetList(strWhere.ToString() + " order by ID desc"); gridView3.DataSource = ds; gridView3.DataBind(); } else if (model.types.Value == 4) { //综合 gridView4.Visible = true; strWhere.Append(" nodeId=" + ddrNode.SelectedValue); ds = medBll.GetList(strWhere.ToString() + " order by ID desc"); gridView4.DataSource = ds; gridView4.DataBind(); } }