/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll(); try { List<DataTable> ListObjPurchaseOrderRegister = new List<DataTable>(); if (txtOrderNo.Text.Trim() == string.Empty) { strInvoiceNo = string.Empty; } else { strInvoiceNo = txtOrderNo.Text; } if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1) { decLedgerId = -1; } else { decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()); } if (rbtnAll.Checked) { strCondition = "All"; } if (rbtnPendingOrder.Checked) { strCondition = "Pending"; } if (rbtnOverdue.Checked) { strCondition = "Due"; } if (rbtnCancelled.Checked) { strCondition = "Cancelled"; } DateTime FromDate = this.dtpFromDate.Value; DateTime ToDate = this.dtpToDate.Value; ListObjPurchaseOrderRegister = BllPurchaseOrder.PurchaseOrderMasterViewAll(strInvoiceNo, decLedgerId, FromDate, ToDate, strCondition); dgvPurchaseOrderRegister.DataSource = ListObjPurchaseOrderRegister[0]; if (dgvPurchaseOrderRegister.Columns.Count > 0) { dgvPurchaseOrderRegister.Columns["dgvtxtBillAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } } catch (Exception ex) { MessageBox.Show("POREG2:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }