protected void btn_View_bills_Click(object sender, EventArgs e) { if (txt_customer_name.Text == string.Empty) { RequiredFieldValidator1.Text = "Enter Customer Name"; RequiredFieldValidator1.ForeColor = System.Drawing.Color.Red; return; } else { string cust_name = txt_customer_name.Text; DataTable dtCustomerBillInfo = Select_Logic.select_customer_bill_info("select_customer_bill_info_sp", cust_name); dtCustomerBillInfo.Columns.Add("Status"); dtCustomerBillInfo.Columns.Add("Date"); if (dtCustomerBillInfo.Rows.Count == 0) { RequiredFieldValidator1.Text = "No Bills Found"; grv_cust_bills.DataSource = null; grv_cust_bills.DataBind(); } else { foreach (DataRow dr in dtCustomerBillInfo.Rows) { dr["Date"] = Convert.ToDateTime(dr["purchase_date"]).ToString("dd/MM/yyyy"); //dt.ToShortTimeString(); if (Convert.ToInt32(dr["remaining_amount"]) == 0) { dr["Status"] = "Paid"; } else { dr["Status"] = "Pending"; } } dtCustomerBillInfo.Columns.Remove("purchase_date"); grv_cust_bills.DataSource = dtCustomerBillInfo; grv_cust_bills.DataBind(); } } }