protected void GrdFlight_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (Request.QueryString["Port_Name"] != null) { BLL_TRV_Airport al = new BLL_TRV_Airport(); DataTable dt = al.GetAirPort(Request.QueryString["Port_Name"]).Tables[0]; if (dt.Rows.Count > 0) { (e.Row.FindControl("txtFrom1") as UserControl_ctlAirPortList).Text = dt.Rows[0]["iata_code"].ToString(); } } if (Request.QueryString["Event_Date"] != null) { (e.Row.FindControl("txtDepDate1") as TextBox).Text = Convert.ToDateTime(Request.QueryString["Event_Date"]).ToString("dd-MMMM-yyyy"); } try { (e.Row.FindControl("cmbDepHours1") as DropDownList).Items.FindByValue(DataBinder.Eval(e.Row.DataItem, "PrefDephours").ToString()).Selected = true; (e.Row.FindControl("cmbDepMins1") as DropDownList).Items.FindByValue(DataBinder.Eval(e.Row.DataItem, "PrefDepmins").ToString()).Selected = true; } catch { } } }
public String[] GetAirportList(String prefixText, Int32 count) { BLL_TRV_Airport ap = new BLL_TRV_Airport(); DataTable dt; List <string> RetVal = new List <string>(); try { dt = ap.GetAirPort(prefixText).Tables[0]; dt.Rows.Cast <System.Data.DataRow>().Take(count); for (int i = 0; i < dt.Rows.Count; i++) { RetVal.Add(dt.Rows[i]["iata_code"].ToString()); } return(RetVal.ToArray()); } catch { throw; } finally { ap = null; } }