protected void Page_Load(object sender, EventArgs e) { List <Cours> Courses = new List <Cours>(); string role = (string)Session["UserRole"]; Courses = CourseBl.getCourseList(role); if (Courses != null) { Session["Courses"] = Courses; this.gvCourseList.DataSource = Courses; this.gvCourseList.DataBind(); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('You don't have any courses.')", true); } }