protected void uiGridViewAirLines_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView objData = (DataRowView)e.Row.DataItem; AirPorts From = new AirPorts(); AirPorts To = new AirPorts(); Companies Comp = new Companies(); From.LoadByPrimaryKey(Convert.ToInt32(objData["FromAirPortID"].ToString())); Label temp = (Label)e.Row.FindControl("uiLabelFromName"); temp.Text = From.EnName; To.LoadByPrimaryKey(Convert.ToInt32(objData["ToAirPortID"].ToString())); Label temp2 = (Label)e.Row.FindControl("uiLabelToName"); temp2.Text = To.EnName; Comp.LoadByPrimaryKey(Convert.ToInt32(objData["CompanyID"].ToString())); Label temp3 = (Label)e.Row.FindControl("uiLabelCompanyName"); temp3.Text = Comp.ArName; } }
protected void uiGridViewAirPorts_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditAirPort") { AirPorts objData = new AirPorts(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxEnName.Text = objData.EnName; uiTextBoxArName.Text = objData.ArName; uiTextBoxCode.Text = objData.AirPortCode; uiPanelViewAirPorts.Visible = false; uiPanelEdit.Visible = true; CurrentAirPort = objData; } else if (e.CommandName == "DeleteAirPort") { AirPorts objData = new AirPorts(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentAirPort = null; BindData(); } }