protected void uiGridViewHistory_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView row = (DataRowView)e.Row.DataItem; Label lblfrom = (Label)e.Row.FindControl("uiLabelFrom"); Label lblto = (Label)e.Row.FindControl("uiLabelTo"); Label lblstatus = (Label)e.Row.FindControl("uiLabelStatus"); AirPort airport = new AirPort(); airport.LoadByPrimaryKey(Convert.ToInt32(row["From_AirportID"].ToString())); lblfrom.Text = airport.IATACode; airport.LoadByPrimaryKey(Convert.ToInt32(row["To_AirportID"].ToString())); lblto.Text = airport.IATACode; TicketStatus Status = new TicketStatus(); if (!string.IsNullOrEmpty(row["TicketStatusID"].ToString())) { Status.LoadByPrimaryKey(Convert.ToInt32(row["TicketStatusID"].ToString())); if (Session["CurrentCulture"].ToString() == "ar-EG") lblstatus.Text = Status.ArName; else lblstatus.Text = Status.EnName; } } }
private void LoadDDLs() { Passenger customers = new Passenger(); customers.LoadAll(); customers.AddColumn("DisplayName", typeof(string)); for (int i = 0; i < customers.RowCount; i++) { customers.SetColumn("DisplayName", customers.FirstName + " " + customers.LastName); customers.MoveNext(); } uiDropDownListCustomer.DataSource = customers.DefaultView; uiDropDownListCustomer.DataTextField = "DisplayName"; uiDropDownListCustomer.DataValueField = Passenger.ColumnNames.PassengerID; uiDropDownListCustomer.DataBind(); AirLine AirLines = new AirLine(); AirLines.LoadAll(); uiDropDownListAirLine.DataSource = AirLines.DefaultView; uiDropDownListAirLine.DataTextField = AirLine.ColumnNames.Name; uiDropDownListAirLine.DataValueField = AirLine.ColumnNames.AirLineID; uiDropDownListAirLine.DataBind(); AirPort Airports = new AirPort(); Airports.LoadAll(); uiDropDownListFrom.DataSource = Airports.DefaultView; uiDropDownListFrom.DataTextField = AirPort.ColumnNames.IATACode; uiDropDownListFrom.DataValueField = AirPort.ColumnNames.AirPortID; uiDropDownListFrom.DataBind(); uiDropDownListTo.DataSource = Airports.DefaultView; uiDropDownListTo.DataTextField = AirPort.ColumnNames.IATACode; uiDropDownListTo.DataValueField = AirPort.ColumnNames.AirPortID; uiDropDownListTo.DataBind(); CreditCard cards = new CreditCard(); cards.LoadAll(); uiDropDownListCreditCard.DataSource = cards.DefaultView; uiDropDownListCreditCard.DataTextField = CreditCard.ColumnNames.CardNumber; uiDropDownListCreditCard.DataValueField = CreditCard.ColumnNames.CreditCardID; uiDropDownListCreditCard.DataBind(); TicketStatus status = new TicketStatus(); status.LoadAll(); uiDropDownListStatus.DataSource = status.DefaultView; if (Session["CurrentCulture"].ToString() == "ar-EG") uiDropDownListStatus.DataTextField = TicketStatus.ColumnNames.ArName; else uiDropDownListStatus.DataTextField = TicketStatus.ColumnNames.EnName; uiDropDownListStatus.DataValueField = TicketStatus.ColumnNames.TicketStatusID; uiDropDownListStatus.DataBind(); }