protected void btnAddCourse_Click(object sender, EventArgs e) { if (IsLoggedIn) { Course c = new Course(); c.CourseName = txtCourseName.Text; c.CreatedBy = CurrentUser.Email; Result <Course> result; if (string.IsNullOrEmpty(hfCourseID.Value)) { result = cms.AddNewCourse(c); } else { c.ID = int.Parse(hfCourseID.Value); result = cms.UpdateCourse(c); } if (result.isSuccess) { hfCourseID.Value = string.Empty; txtCourseName.Text = string.Empty; LoadData(); cvCourseItem.CssClass = "alert-success"; } else { cvCourseItem.CssClass = "alert-danger"; } cvCourseItem.ErrorMessage = result.message; cvCourseItem.IsValid = false; //ShowMessage(result.message); } }
protected void lbAdd_Click(object sender, EventArgs e) { if (IsLoggedIn) { HiddenField hf = (HiddenField)((LinkButton)sender).NamingContainer.FindControl("hdnCourseName"); string message; if (hf != null) { string courseName; courseName = hf.Value; Result <Course> result; Course newCourse = new Course(); newCourse.CourseName = courseName; result = cms.AddNewCourse(newCourse); message = result.message; if (result.isSuccess) { LoadPendingRequests(); } ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal('" + message + "');", true); } } }