private void FillGridPayDescStation() { const string METHOD_NAME = "FillGridPayDescStation"; bool isShidSearch = false; try { grdPayDescStation.SelectedIndex = -1; int description_station_id = 0; string description_id_list = ""; int factory_no = 0; if (lstFactory.SelectedIndex != -1) { factory_no = Convert.ToInt32(Common.UILib.GetListValues(lstFactory)); } string station_no_list = _stationList; string contract_no_list = _contractList; string payment_no_list = _paymentList; int icrop_year = Convert.ToInt32(ddlCropYear.Text); string Shid = txtSHID.Text.Replace(" ", "").Trim(); if (Shid != "") { lstFactory.SelectedIndex = -1; lstStation.Items.Clear(); isShidSearch = true; } using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) { using (SqlDataReader dr = WSCPayment.GetPaymentDescriptionContract(conn, description_station_id, description_id_list, factory_no, station_no_list, contract_no_list, payment_no_list, Shid, icrop_year)) { grdPayDescStation.DataSource = dr; grdPayDescStation.DataBind(); if (isShidSearch) { lstContract.Items.Clear(); foreach (GridViewRow row in grdPayDescStation.Rows) { ListItem item = new ListItem( row.Cells[(int)grdPayDescStationColumns.pdecnt_contract_no].Text, row.Cells[(int)grdPayDescStationColumns.pdecnt_contract_no].Text ); lstContract.Items.Add(item); lstContract.Items[lstContract.Items.Count - 1].Selected = true; } } } } } catch (Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); throw (wex); } }