Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UWProjectQ3.SqlHelper sqlHlpr    = new UWProjectQ3.SqlHelper();
        List <Clss>           allClasses = new List <Clss>();

        allClasses = sqlHlpr.GetAllClasses();

        gvAllClasses.DataSource = allClasses;
        gvAllClasses.DataBind();
        //if(gvAllClasses.SelectedRow != null)
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Get Seesion Values WIP Sheelam
        //if (Session != null)
        //{
        //    u = new User(Session["UserName"].ToString(), (int)Session["StudentId"]);
        //}
        // Sheelam Debug only
        u = new User("Sue Jones", 2);
        UWProjectQ3.SqlHelper sqlHlpr    = new UWProjectQ3.SqlHelper();
        List <Clss>           allClasses = new List <Clss>();

        allClasses = sqlHlpr.GetAllClasses();
        sqlHlpr.GetUserClasses(u);

        DataView dv = CreateDataSource(allClasses, u.RegisteredClasses);

        foreach (DataRowView dr in dv)
        {
            if ((bool)dr["Registered"] == false)
            {
                rblRegister.Items.Add(new ListItem {
                    Text = (string)dr["Name"] + ": " + (string)dr["Descritpion"], Value = dr["Class Id"].ToString()
                });
            }
            else
            {
                rblUnregister.Items.Add(new ListItem {
                    Text = (string)dr["Name"] + ": " + (string)dr["Descritpion"], Value = dr["Class Id"].ToString()
                });
            }
        }
        //ListItem li = new ListItem()
        //CheckBoxList1.DataSource = CreateDataSource(allClasses, u.RegisteredClasses);
        //CheckBoxList1.DataTextField ="Name";
        //CheckBoxList1.DataValueField = "Class Id";
        //CheckBoxList1.DataBind();
    }