protected void Submit_Click(object sender, EventArgs e) { TicketViewModel vmModel = new TicketViewModel(); vmModel.Number = Convert.ToInt32(Number.Text); vmModel.Price = Convert.ToInt32(Price.Text); if (HiddenField1.Value != "") { vmModel.ID = Convert.ToInt32(HiddenField1.Value); } vmModel = iTicketService.AddAndUpdate(vmModel); if (vmModel.ID > 0) { Response.Write("<script>alert('Record saved successfully')</script>"); Response.Redirect("Ticket.aspx"); } bindGrid(); }