public void gridViewBindForProductGoldPrice() { DataSet allPGPDetails = saProductGoldPriceBo.GetAllGoldPriceDetails(); GridViewDetails.DataSource = allPGPDetails; GridViewDetails.DataBind(); }
protected void GridViewTop_SelectedIndexChanged(object sender, EventArgs e) { int count = Convert.ToInt32(GridViewTop.SelectedRow.Cells[0].Text); DateTime StartTime = Convert.ToDateTime(hidStartDate.Value); DateTime EndTime = Convert.ToDateTime(hidEndDate.Value); var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities(); ProjectModel.Database.CommandTimeout = 600000; var AllOrder = (from o in ProjectModel.TempOrder join c in ProjectModel.TempCourse on o.CourseId equals c.CourseId where (c.type == "自筹") && (!string.IsNullOrEmpty(c.SourceCourseId)) && (c.SourceCourseId != "") && (c.CreateDate >= StartTime) && (c.CreateDate <= EndTime) select new { name = c.title, sourceid = c.SourceCourseId, customid = o.CustomerId }); var DistinctOrder = AllOrder.GroupBy(o => new { o.customid, o.sourceid }) .Select(g => g.FirstOrDefault()); var OrderCount = from o in DistinctOrder group o by new { o.sourceid } into oc where oc.Count() == count select new { //id = oc.Key.sourceid, title = (from c in ProjectModel.TempCourse where c.SourceCourseId == oc.Key.sourceid select new { title = c.title }).FirstOrDefault().title, count = oc.Count() }; GridViewDetails.DataSource = OrderCount.ToList(); GridViewDetails.DataBind(); }
// Populating the details (2nd GridView) below protected void btnView_Click(object sender, EventArgs e) { Button btn = (Button)sender; string tempText = btn.CommandArgument.ToString(); int reqID = Convert.ToInt32(tempText); // Retrieve details list var tempList = RequisitionLogic.RetrieveRequisitionRecordDetails(reqID, "Processed"); if (tempList.Count() != 0) { // Populating the labels associated with the gridview LblSelected.Text = "Request ID: "; LblItemIDInfo.Text = "RQ" + tempText; LblDetails.Text = "Details"; } else { // Populating the labels associated with the gridview LblSelected.Text = "No past records were retrieved."; LblSelected.ForeColor = System.Drawing.Color.Red; LblItemIDInfo.Text = ""; LblDetails.Text = "Details"; } // Binding the grid view GridViewDetails.DataSource = tempList; GridViewDetails.DataBind(); }
//bind data to the grid view : user defined method private void BindData() { //Response.Write(value_date); DataTable dt = new DataTable(); using (OracleConnection oracon = new OracleConnection(Connection.con_str_oracle_ceyt)) { using (OracleCommand cmd = oracon.CreateCommand()) { string query = "select to_char(trim(sfc_initials)||' '||trim(sfc_first_name)||' '||trim(sfc_surname))full_name,sfc_nic_no,sfc_mobile1 " + " from sm_m_sales_force where sfc_code='" + TextBoxEpfNo.Text.Trim() + "'"; cmd.CommandText = query; oracon.Open(); OracleDataAdapter sda = new OracleDataAdapter(); sda.SelectCommand = cmd; sda.Fill(dt); ViewState["CurrentTable"] = dt; if (dt.Rows.Count > 0) { // BIND QUERY RESULT WITH THE GRIDVIEW. GridViewDetails.DataSource = dt; GridViewDetails.DataBind(); } } } }
public void BindGoldGridView() { int count; DataSet ds = saProductGoldPriceBo.GetDataBetweenDatesForGoldPrice(saProductGoldPriceVo, ProductGoldPriceID, mypager.CurrentPage, out count); if (ds.Tables[0].Rows.Count > 0) { tblErrorMassage.Visible = false; GridViewDetails.DataSource = ds; GridViewDetails.DataBind(); mypager.Visible = true; hdnRecordCount.Value = count.ToString(); GetPageCount(); lblCurrentPage.Visible = true; lblTotalRows.Visible = true; } else { tblErrorMassage.Visible = true; ErrorMessage.InnerText = "No Records found.."; GridViewDetails.DataSource = ds; GridViewDetails.DataBind(); mypager.Visible = false; lblCurrentPage.Visible = false; lblTotalRows.Visible = false; } }
protected void LBtnRID_Click(object sender, EventArgs e) { LinkButton lb = (LinkButton)sender; int reqID = Utility.Utility.GetValidPrimaryKeyInt(lb.Text); // Retrieve details list var tempList = RequisitionLogic.FindRequisitionRecordDetailsByReqID(reqID); if (tempList.Count() != 0) { // Populating the labels associated with the gridview LblSelected.Text = "Request ID: "; LblItemIDInfo.Text = lb.Text; LblDetails.Text = "Details"; } else { // Populating the labels associated with the gridview LblSelected.Text = "No past records were retrieved."; LblSelected.ForeColor = System.Drawing.Color.Red; LblItemIDInfo.Text = ""; LblDetails.Text = "Details"; } // Binding the grid view GridViewDetails.DataSource = tempList; GridViewDetails.DataBind(); }
/* * load default form * */ public void LoadDefault() { TextBoxEpfNo.Text = ""; //LabelErr.Text = ""; GridViewDetails.DataSource = null; GridViewDetails.DataBind(); ButtonSubmit.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; using (SqlConnection sqlCon = new SqlConnection(DBConnect)) { sqlCon.Open(); SqlDataAdapter sqlDa = new SqlDataAdapter("Select * from Trip", sqlCon); DataTable dtbl = new DataTable(); sqlDa.Fill(dtbl); GridViewDetails.DataSource = dtbl; GridViewDetails.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // Retrieving from the link our req ID reqID = Request.QueryString["RequestID"]; // Retrieving our req record using the reqID retrieved RequisitionRecord tempR = RequisitionLogic.FindRequisitionRecord(Convert.ToInt32(reqID)); if (!IsPostBack) { // Populating the labels... LblReqFormID.Text = Convert.ToString("RQ" + tempR.RequestID); LblEmployeeName.Text = tempR.RequestorName; LblDateCreated.Text = tempR.RequestDate.Value.ToString("MM/dd/yyyy"); LblStatus.Text = RequisitionLogic.GetStatus(Convert.ToInt32(reqID)); if (String.IsNullOrWhiteSpace(tempR.Remarks)) { TxtRemarks.Text = "No remarks."; } else { TxtRemarks.Text = tempR.Remarks; } // Toggling the visibilty of the "Approve" and "Reject" controls --- If "Pending", will still remain invisible if (RequisitionLogic.GetStatus(Convert.ToInt32(reqID)).Equals("Pending")) { TxtRemarks.Text = ""; BtnApprove.Visible = true; BtnReject.Visible = true; LblDateApproved.Text = "Pending"; LblMessage.Text = "To approve or reject this request, kindly select one of the following options below."; } else { // Other attrs LblMessage.Text = ""; // For previously approved request LblDateApproved.Text = tempR.ApprovedDate.Value.ToString("MM/dd/yyyy"); TxtRemarks.Attributes.Add("readonly", "readonly"); } } // Populating the gridview GridViewDetails.DataSource = RequisitionLogic.FindRequisitionRecordDetailsByReqID(Convert.ToInt32(reqID)); GridViewDetails.DataBind(); }
// Populating the details (2nd GridView) below protected void btnView_Click(object sender, EventArgs e) { Button btn = (Button)sender; string tempText = btn.CommandArgument.ToString(); int reqID = Convert.ToInt32(tempText); // Populating the labels associated with the gridview LblSelected.Text = "Request ID: "; LblItemIDInfo.Text = "RQ" + tempText; LblDetails.Text = "Details"; // Changing the visibility of the button var tempList = RequisitionLogic.RetrieveRequisitionRecordDetails(reqID, "Approved"); // Binding the gridview GridViewDetails.DataSource = tempList; GridViewDetails.DataBind(); }
protected void hiddenassociation_Click(object sender, EventArgs e) { string val = Convert.ToString(hdnMsgValue.Value); goldId = hdnGoalId.Value; if (val == "1") { saProductGoldPriceBo.deleteGoldPriceDetails(int.Parse(goldId)); msgRecordStatus.Visible = true; saProductGoldPriceVo.Pg_fromDate = DateTime.Parse(txtFromDate.Text); saProductGoldPriceVo.Pg_toDate = DateTime.Parse(txtToDate.Text); int count; DataSet ds = saProductGoldPriceBo.GetDataBetweenDatesForGoldPrice(saProductGoldPriceVo, ProductGoldPriceID, mypager.CurrentPage, out count); if (ds.Tables[0].Rows.Count > 0) { hdnDateFilter.Value = ""; // lblMsg.Visible = false; tblErrorMassage.Visible = false; GridViewDetails.DataSource = ds; GridViewDetails.DataBind(); mypager.Visible = true; hdnRecordCount.Value = count.ToString(); GetPageCount(); btnDelete.Visible = true; btnEdit.Visible = true; lblCurrentPage.Visible = true; lblTotalRows.Visible = true; } else { GridViewDetails.DataSource = ds; GridViewDetails.DataBind(); mypager.Visible = false; lblCurrentPage.Visible = false; lblTotalRows.Visible = false; btnEdit.Visible = false; btnDelete.Visible = false; btnReset.Visible = false; } clearTextFields(); } }
protected void txtDateSearch_TextChanged(object sender, EventArgs e) { txtDateSearch = (TextBox)GridViewDetails.HeaderRow.FindControl("txtDateSearch"); if (txtDateSearch.Text == "") { saProductGoldPriceVo.Pg_fromDate = DateTime.Parse(txtFromDate.Text); saProductGoldPriceVo.Pg_toDate = DateTime.Parse(txtToDate.Text); BindGoldGridView(); } else { DateTime txtDate = DateTime.Parse(txtDateSearch.Text); DataSet ds = saProductGoldPriceBo.GetGoldPriceAccordingToDate(txtDate); if (ds.Tables[0].Rows.Count > 0) { tblErrorMassage.Visible = false; hdnDateFilter.Value = txtDateSearch.Text.Trim(); GridViewDetails.DataSource = ds; GridViewDetails.DataBind(); mypager.Visible = true; lblCurrentPage.Visible = true; lblTotalRows.Visible = true; } else { tblErrorMassage.Visible = true; ErrorMessage.InnerText = "No Records found.."; hdnDateFilter.Value = txtDateSearch.Text.Trim(); GridViewDetails.DataSource = ds; GridViewDetails.DataBind(); mypager.Visible = false; lblCurrentPage.Visible = false; lblTotalRows.Visible = false; btnEdit.Visible = false; btnDelete.Visible = false; btnAdd.Visible = false; } } }
// Dropdownlist manipulation protected void DdlDeptList_SelectedIndexChanged(object sender, EventArgs e) { // Retrieve the value currently selected in the dropdownlist string val = DdlDeptList.SelectedValue; if (val == "All") { // Populating all past req records LoadAllData(); } else { // Populating the first gridview based on the selected department LoadDataByDept(val); } // Clearing the details gridview LblDetails.Text = null; LblSelected.Text = null; LblItemIDInfo.Text = null; GridViewDetails.DataSource = null; GridViewDetails.DataBind(); }
private void FillPerils() { dt = (DataTable)ViewState["Details"]; for (int j = 0; j < init_values.Count; j++) { if (init_values[j].ToString() == "0" || init_values[j].ToString() == "0.0" || init_values[j].ToString() == "0.00") { } else { dt.Rows.Add(init_perils[j].ToString(), init_values[j].ToString(), init_code[j].ToString()); } } ViewState["Details"] = dt; GridViewDetails.DataSource = dt; GridViewDetails.DataBind(); // GridViewDetails.Columns[3].Visible = false; //BorderStyle="Solid" GridLines="Both" //GridViewDetails.GridLines="Both"; GridViewDetails.FooterRow.Cells[0].Text = "Peril Total"; GridViewDetails.FooterRow.Cells[0].HorizontalAlign = HorizontalAlign.Right; GridViewDetails.FooterRow.Cells[0].Font.Bold = true; GridViewDetails.FooterRow.Cells[1].Text = totalPerilAmt; GridViewDetails.FooterRow.Cells[1].HorizontalAlign = HorizontalAlign.Right; GridViewDetails.FooterRow.Cells[1].Font.Bold = true; GridViewDetails.HeaderRow.Cells[0].HorizontalAlign = HorizontalAlign.Center; GridViewDetails.HeaderRow.Cells[0].Font.Bold = true; GridViewDetails.HeaderRow.Cells[1].HorizontalAlign = HorizontalAlign.Center; GridViewDetails.HeaderRow.Cells[1].Font.Bold = true; }
private void ClearTables() { ViewState["Details"] = null; GridViewDetails.DataSource = null; GridViewDetails.DataBind(); }