private void BindGridView() { string strMessage = string.Empty; string strCriteria = string.Empty; string strunit_code = string.Empty; cItem_acc oItem_acc = new cItem_acc(); DataSet ds = new DataSet(); try { strCriteria = " And item_acc_doc ='" + ViewState["item_acc_doc"].ToString() + "' "; if (!oItem_acc.SP_ITEM_ACC_DETAIL_SEL(strCriteria, ref ds, ref strMessage)) { lblError.Text = strMessage; } else { if (ds.Tables[0].Rows.Count == 0) { strCriteria = " And pay_month ='" + cboPay_Month.SelectedValue + "' "; strCriteria += " And pay_year ='" + cboPay_Year.SelectedValue + "' "; if (base.myBudgetType == "B") { strCriteria += " And payment_detail_person_group_code in (" + PersonGroupList + ",'') "; } if (base.myBudgetType != "M") { strCriteria += " And payment_detail_budget_type ='" + base.myBudgetType + "' "; } if (!oItem_acc.SP_ITEM_ACC_TMP_SEL(strCriteria, ref ds, ref strMessage)) { lblError.Text = strMessage; } } ds.Tables[0].DefaultView.Sort = ViewState["sort"].ToString() + " " + ViewState["direction"].ToString(); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); } finally { if (GridView1.Rows.Count == 0) { EmptyGridFix(GridView1); } oItem_acc.Dispose(); ds.Dispose(); } }