protected void uiButtonUpdate_Click(object sender, EventArgs e) { if (CurrentSeaPort != null) { UpdateRecord(); } else { AddNewRecord(); } uiPanelEdit.Visible = false; uiPanelViewSeaPorts.Visible = true; BindData(); Clearfields(); CurrentSeaPort = null; }
protected void uiGridViewSeaPorts_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditSeaPort") { SeaPorts objData = new SeaPorts(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxEnName.Text = objData.EnName; uiTextBoxArName.Text = objData.ArName; uiTextBoxCode.Text = objData.SeaPortCode; uiPanelViewSeaPorts.Visible = false; uiPanelEdit.Visible = true; CurrentSeaPort = objData; } else if (e.CommandName == "DeleteSeaPort") { SeaPorts objData = new SeaPorts(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentSeaPort = null; BindData(); } }