protected void btnSave_Click(object sender, EventArgs e) { try { if (!Page.IsValid) return; BLTunnit tunti = new BLTunnit(); tunti.koodaaja = txtkoodaaja.Text; tunti.paivamaara = txtpvm.Text; tunti.tuntimaara = txttuntimaara.Text; tunti.minuutit = txtminuutit.Text; tunti.id = Convert.ToInt64(hndId.Value); TunnitDAL objTuntiDAL = new TunnitDAL(); if ((hndId.Value.Trim().Length > 0) && (Convert.ToInt64(hndId.Value) > 0)) objTuntiDAL.Update(tunti); else objTuntiDAL.Create(tunti); ClearScreen(); BindGrid(); lblMessage.Text = "Record saved successfully"; } catch (Exception ex) { lblMessage.Text = "There is an error occured while processing the request. Please verify the code!"; } }