private void BindDataGrid() { DataTable dtPendingOrders = pendingOrderAndQuotes.GetPendingOrders(BuildWhereClause()); if (dtPendingOrders != null && dtPendingOrders.Rows.Count == 0) // if datatable is empty add new row for display purpose { DataRow dr = dtPendingOrders.NewRow(); dtPendingOrders.Rows.Add(dr); } dtPendingOrders.DefaultView.Sort = "OrderNo asc"; gvPendingOrders.DataSource = dtPendingOrders.DefaultView.ToTable(); gvPendingOrders.DataBind(); // Hide Deleted Date Column base on mode gvPendingOrders.Columns[10].Visible = (ViewState["Mode"].ToString() != "ShowAll" ? false : true); }
private void BindDataGrid() { DataTable dtPendingOrders = pendingOrderAndQuotes.GetPendingOrders(BuildWhereClause()); if (dtPendingOrders.Rows.Count == 0) // if datatable is empty add new row for display purpose { DataRow dr = dtPendingOrders.NewRow(); dtPendingOrders.Rows.Add(dr); if (Page.IsPostBack && ViewState["Action"] != "Clear") { utility.DisplayMessage(MessageType.Failure, noRecordMessage, lblMessage); pnlStatusMessage.Update(); } } else { utility.DisplayMessage(MessageType.Success, successMessage, lblMessage); pnlStatusMessage.Update(); } dtPendingOrders.DefaultView.Sort = (hidSort.Value == "") ? "OrderNo asc" : hidSort.Value; gvPendingOrders.DataSource = dtPendingOrders.DefaultView.ToTable(); gvPendingOrders.DataBind(); // Hide Deleted Date Column base on mode gvPendingOrders.Columns[10].Visible = (ViewState["Mode"].ToString() == "Active" ? false : true); pnlPendingOrderGrid.Update(); // Create Post url for utility dialog hidPrintURL.Value = Server.UrlEncode("PendingOrdersAndQuotesExport.aspx?CustomerNo=" + txtCustomerNumber.Text + "&LocDesc=" + (ddlLocation.SelectedIndex != 0 ? ddlLocation.SelectedItem.Text : "") + "&loccode=" + (ddlLocation.SelectedIndex != 0 ? ddlLocation.SelectedItem.Value : "") + "&OrderTypeDesc=" + (ddlOrderType.SelectedIndex != 0 ? ddlOrderType.SelectedItem.Text : "") + "&OrderTypeValue=" + (ddlOrderType.SelectedIndex != 0 ? ddlOrderType.SelectedItem.Value : "") + "&UserID=" + ddlUserID.SelectedItem.Value + "&UserName="******"&StartDate=" + dtpStartDt.SelectedDate + "&EndDate=" + dtpEndDt.SelectedDate + "&ShowDelRecord=" + ViewState["Mode"].ToString()); }