private void FetchDetails() { FestivalBAL fs = new FestivalBAL(); ds = fs.FetchFestival(); grdFestival.DataSource = ds.Tables[0]; grdFestival.DataBind(); }
protected void ddlSearchCategory_SelectedIndexChanged(object sender, EventArgs e) { if (ddlSearchCategory.SelectedItem.Text != "Select") { ddlSearchCategory1.Enabled = true; } else { ddlSearchCategory1.SelectedIndex = 0; ddlSearchCategory1.Enabled = false; // fetch value of the grid details.... DataSet ds1 = new DataSet(); FestivalBAL fs = new FestivalBAL(); ds1 = fs.FetchFestival(); grdFestival.DataSource = ds1.Tables[0]; grdFestival.DataBind(); //End fetch value of the grid details.... } }
protected void gridPageChanging(object sender, GridViewPageEventArgs e) { if (ddlSearchCategory.SelectedItem.Text == "Select" & ddlSearchCategory1.SelectedItem.Text == "Select") { DataSet ds1 = new DataSet(); FestivalBAL fs = new FestivalBAL(); ds1 = fs.FetchFestival(); grdFestival.DataSource = ds1.Tables[0]; grdFestival.PageIndex = e.NewPageIndex; grdFestival.DataBind(); } else { DataTable ds = new DataTable(); GeneralBAL lp = new GeneralBAL(); ds = lp.FetchFestivalGridDetails(ddlSearchCategory1.SelectedItem.Text); grdFestival.DataSource = ds; grdFestival.PageIndex = e.NewPageIndex; grdFestival.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Fetch Grid Page Size Details... DataTable pg = new DataTable(); GeneralBAL pz = new GeneralBAL(); pg = pz.FetchGridPageSize(); if (pg.Rows.Count != 0 && pg.Rows[0][0].ToString() != string.Empty) grdFestival.PageSize = Convert.ToInt32(pg.Rows[0][0].ToString()); #endregion // Bind the banner of the image. DataSet ds = new DataSet(); GeneralDAL lp = new GeneralDAL(); ds = lp.FetchBanner(); if (ds.Tables[3].Rows.Count != 0) imgBanner.ImageUrl = ds.Tables[3].Rows[0][1].ToString(); //End Bind the banner of the image. // fetch value of the grid details.... DataSet ds1 = new DataSet(); FestivalBAL fs = new FestivalBAL(); ds1 = fs.FetchFestival(); grdFestival.DataSource = ds1.Tables[0]; grdFestival.DataBind(); //End fetch value of the grid details.... //if comes from index page if (Session["festivalId"] != null) { int rowno=0; for (int i = 0; ds1.Tables[0].Rows.Count > i; i++) { if (ds1.Tables[0].Rows[i]["festivalid"].ToString() == Session["festivalId"].ToString()) rowno = i; } FetchGridDetails(Session["festivalId"].ToString()); grdFestival.PageIndex = rowno / grdFestival.PageSize; int SelectedRowIndex = rowno - (grdFestival.PageSize * grdFestival.PageIndex); grdFestival.DataBind(); grdFestival.Rows[SelectedRowIndex].BackColor = System.Drawing.Color.LightGray; Session["festivalId"] = null; }//other load festival here..... else if (Request.QueryString["festivalId"] != null) { int rowno = 0; for (int i = 0; ds1.Tables[0].Rows.Count > i; i++) { if (ds1.Tables[0].Rows[i]["festivalid"].ToString() == Request.QueryString["festivalId"].ToString()) rowno = i; } FetchGridDetails(Request.QueryString["festivalId"].ToString()); grdFestival.PageIndex = rowno / grdFestival.PageSize; int SelectedRowIndex = rowno - (grdFestival.PageSize * grdFestival.PageIndex); grdFestival.DataBind(); grdFestival.Rows[SelectedRowIndex].BackColor = System.Drawing.Color.LightGray; } else { if (ds1.Tables[0].Rows.Count != 0) { FetchGridDetails(ds1.Tables[0].Rows[0][0].ToString()); grdFestival.Rows[0].BackColor = System.Drawing.Color.LightGray; } } } }
protected void ddlSearchCategory_SelectedIndexChanged(object sender, EventArgs e) { if (ddlSearchCategory.SelectedItem.Text != "Select") ddlSearchCategory1.Enabled = true; else { ddlSearchCategory1.SelectedIndex = 0; ddlSearchCategory1.Enabled = false; // fetch value of the grid details.... DataSet ds1 = new DataSet(); FestivalBAL fs = new FestivalBAL(); ds1 = fs.FetchFestival(); grdFestival.DataSource = ds1.Tables[0]; grdFestival.DataBind(); //End fetch value of the grid details.... } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Fetch Grid Page Size Details... DataTable pg = new DataTable(); GeneralBAL pz = new GeneralBAL(); pg = pz.FetchGridPageSize(); if (pg.Rows.Count != 0 && pg.Rows[0][0].ToString() != string.Empty) { grdFestival.PageSize = Convert.ToInt32(pg.Rows[0][0].ToString()); } #endregion // Bind the banner of the image. DataSet ds = new DataSet(); GeneralDAL lp = new GeneralDAL(); ds = lp.FetchBanner(); if (ds.Tables[3].Rows.Count != 0) { imgBanner.ImageUrl = ds.Tables[3].Rows[0][1].ToString(); } //End Bind the banner of the image. // fetch value of the grid details.... DataSet ds1 = new DataSet(); FestivalBAL fs = new FestivalBAL(); ds1 = fs.FetchFestival(); grdFestival.DataSource = ds1.Tables[0]; grdFestival.DataBind(); //End fetch value of the grid details.... //if comes from index page if (Session["festivalId"] != null) { int rowno = 0; for (int i = 0; ds1.Tables[0].Rows.Count > i; i++) { if (ds1.Tables[0].Rows[i]["festivalid"].ToString() == Session["festivalId"].ToString()) { rowno = i; } } FetchGridDetails(Session["festivalId"].ToString()); grdFestival.PageIndex = rowno / grdFestival.PageSize; int SelectedRowIndex = rowno - (grdFestival.PageSize * grdFestival.PageIndex); grdFestival.DataBind(); grdFestival.Rows[SelectedRowIndex].BackColor = System.Drawing.Color.LightGray; Session["festivalId"] = null; }//other load festival here..... else if (Request.QueryString["festivalId"] != null) { int rowno = 0; for (int i = 0; ds1.Tables[0].Rows.Count > i; i++) { if (ds1.Tables[0].Rows[i]["festivalid"].ToString() == Request.QueryString["festivalId"].ToString()) { rowno = i; } } FetchGridDetails(Request.QueryString["festivalId"].ToString()); grdFestival.PageIndex = rowno / grdFestival.PageSize; int SelectedRowIndex = rowno - (grdFestival.PageSize * grdFestival.PageIndex); grdFestival.DataBind(); grdFestival.Rows[SelectedRowIndex].BackColor = System.Drawing.Color.LightGray; } else { if (ds1.Tables[0].Rows.Count != 0) { FetchGridDetails(ds1.Tables[0].Rows[0][0].ToString()); grdFestival.Rows[0].BackColor = System.Drawing.Color.LightGray; } } } }