protected void grdGradeMaster_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete_Grade") { int rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; GridViewRow grid = grdGradeMaster.Rows[rowIndex]; int id = Convert.ToInt32(((Label)grid.FindControl("lblID")).Text); obj1 = new GradeMasterDataManager(); obj1.DeleteGradeDetail(id); Clear(); bind(); msgbox("Grade Deleted successfully!!!"); } }
protected void btnAddCourse_Click(object sender, EventArgs e) { obj = new GradeMaster(); obj.Grade = txtName.Text; obj.Description = txtDescription.Text; //obj.IsVisible = chkVisible.Checked; obj.CreatedBy = 1; obj.UpdatedBy = 1; obj.GradeID = Convert.ToInt16(lblGradeID.Text); if (lblGradeID.Text.Equals("-1")) { obj1 = new GradeMasterDataManager(); obj1.AddGradeDetail(obj); msgbox("Grade Added successfully!!!"); } else { obj1 = new GradeMasterDataManager(); obj1.UpdateGradeDetail(obj); msgbox("Grade updated successfully!!!"); } Clear(); bind(); }
private void bind() { obj1 = new GradeMasterDataManager(); grdGradeMaster.DataSource = obj1.GetGradeList(); grdGradeMaster.DataBind(); }