public void FillGrid() { DataTable dt = ObjTransferHeader.GetTransferHeader(strCompId, StrBrandId, StrLocId); dt.Columns.Add("Location_Name"); for (int i = 0; i < dt.Rows.Count; i++) { try { DataTable Dtlocation = objLocation.GetLocationMasterById(strCompId, dt.Rows[i]["ToLocationID"].ToString()); dt.Rows[i]["Location_Name"] = Dtlocation.Rows[0]["Location_Name"].ToString(); } catch { } } GvTransfer.DataSource = dt; GvTransfer.DataBind(); lblTotalRecords.Text = Resources.Attendance.Total_Records + " : " + dt.Rows.Count; Session["dtTransfer"] = dt; Session["dtFilter"] = dt; AllPageCode(); }
public void FillGrid() { DataTable dt = ObjTransferHeader.GetTransferHeaderForTransferIn(strCompId, StrBrandId, StrLocId); string Post = "Y"; dt = new DataView(dt, "Post<>'" + Post + "'", "", DataViewRowState.CurrentRows).ToTable();; dt.Columns.Add("Request_No"); dt.Columns.Add("Request_Date"); for (int i = 0; i < dt.Rows.Count; i++) { try { DataTable dtRequest = ObjTransReq.GetRecordUsingTransId(strCompId, StrBrandId, dt.Rows[i]["ToLocationId"].ToString(), dt.Rows[i]["RequestNo"].ToString()); dt.Rows[i]["Request_No"] = dtRequest.Rows[0]["RequestNo"].ToString(); dt.Rows[i]["Request_Date"] = dtRequest.Rows[0]["TDate"].ToString(); } catch { } } GvTransfer.DataSource = dt; GvTransfer.DataBind(); lblTotalRecords.Text = Resources.Attendance.Total_Records + " : " + dt.Rows.Count; Session["dtTransfer"] = dt; Session["dtFilter"] = dt; AllPageCode(); }
protected void btnbindrpt_Click(object sender, ImageClickEventArgs e) { if (ddlOption.SelectedIndex != 0) { string condition = string.Empty; if (ddlOption.SelectedIndex == 1) { condition = "convert(" + ddlFieldName.SelectedValue + ",System.String)='" + txtValue.Text.Trim() + "'"; } else if (ddlOption.SelectedIndex == 2) { condition = "convert(" + ddlFieldName.SelectedValue + ",System.String) like '%" + txtValue.Text.Trim() + "%'"; } else { condition = "convert(" + ddlFieldName.SelectedValue + ",System.String) Like '" + txtValue.Text.Trim() + "%'"; } DataTable dtCust = (DataTable)Session["DtTransfer"]; DataView view = new DataView(dtCust, condition, "", DataViewRowState.CurrentRows); Session["dtFilter"] = view.ToTable(); lblTotalRecords.Text = Resources.Attendance.Total_Records + ": " + view.ToTable().Rows.Count.ToString() + ""; GvTransfer.DataSource = view.ToTable(); GvTransfer.DataBind(); AllPageCode(); btnbind.Focus(); } }
protected void GvTransfer_PageIndexChanging(object sender, GridViewPageEventArgs e) { DataTable dt = (DataTable)Session["DtTransfer"]; GvTransfer.DataSource = dt; GvTransfer.DataBind(); AllPageCode(); }
protected void GvTransfer_Sorting(object sender, GridViewSortEventArgs e) { hdnSort.Value = hdnSort.Value == "ASC" ? "DESC" : "ASC"; DataTable dt = new DataTable(); dt = (DataTable)Session["dtTransfer"]; DataView dv = new DataView(dt); string Query = "" + e.SortExpression + " " + hdnSort.Value + ""; dv.Sort = Query; dt = dv.ToTable(); Session["dtFilter"] = dt; GvTransfer.DataSource = dt; GvTransfer.DataBind(); AllPageCode(); GvTransfer.HeaderRow.Focus(); }