protected void dgTransport_SelectedIndexChanged(object sender, EventArgs e) { int iTransportId = 0; int.TryParse(Convert.ToString(dgTransport.DataKeys[dgTransport.SelectedIndex]), out iTransportId); hfId.Value = iTransportId.ToString(); //SessionHandler"TransportId"] = iTransportId; TransportMaster oTransportMaster = new TransportMaster(); TransportDTO[] oTransportData = oTransportMaster.GetData(iTransportId); if (oTransportData.Length > 0) { txtTransport.Text = oTransportData[0].TransportName.ToString(); } oTransportMaster = null; oTransportData = null; //btnAddNew.Enabled = false; //btnCancel.Enabled = true; btnCancel.Visible = true; btnDelete.Enabled = true; btnEdit.Text = "Update"; //btnEdit.Enabled = true; //btnSave.Enabled = false; lblStatus.Text = ""; }
private void RefreshGrid() { TransportMaster oTransportMaster; TransportDTO[] oTransportData; oTransportMaster = new TransportMaster(); oTransportData = oTransportMaster.GetData(); if (oTransportData != null) { if (oTransportData.Length > 0) { dgTransport.DataSource = oTransportData; dgTransport.DataBind(); } } else { dgTransport.DataSource = null; dgTransport.DataBind(); } txtTransport.Text = ""; oTransportMaster = null; oTransportData = null; }