protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["NID"] != null && !string.IsNullOrEmpty(Request.QueryString["NID"].ToString()) && Request.QueryString["NID"].ToString() != "0") { BindData(); uiPanelAllNews.Visible = false; uiPanelCurrent.Visible = true; } else { DBLayer db = new DBLayer(); uiGridViewAllNews.DataSource = db.GetAllNews(); uiGridViewAllNews.DataBind(); uiPanelAllNews.Visible = true; uiPanelCurrent.Visible = false; } } }
private void BindData() { DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetAllNews(); uiGridViewNews.DataSource = ds; uiGridViewNews.DataBind(); }