Ejemplo n.º 1
0
 //refresh the grid view
 private void refreshTable()
 {
     dt = DBconnection.getSessionsAdmin(DropDownList1.SelectedValue);
     string[] dataKey = { "SessionID" };
     GridView1.DataKeyNames = dataKey;
     GridView1.DataSource   = dt;
     GridView1.DataBind();
 }
Ejemplo n.º 2
0
 //choose to display either workshops or classes
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     //when the index of the drop down list change, update gridview accordingly to chosen value
     dt = DBconnection.getSessionsAdmin(DropDownList1.SelectedValue);
     string[] dataKey = { "SessionID" };
     GridView1.DataKeyNames = dataKey;
     GridView1.DataSource   = dt;
     GridView1.DataBind();
 }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //read data from the database and bind it to a grid view
     //when the page is loaded for the first time
     if (!this.IsPostBack)
     {
         dt = DBconnection.getSessionsAdmin("Class");            //get a list of all sessions from the database
         string[] dataKey = { "SessionID" };                     //string array containing data key column names
         GridView1.DataKeyNames = dataKey;                       //set SessionID column as a data key for the gridview
         GridView1.DataSource   = dt;                            //set a DataTable returned by DBConnection class as a data source for grid view
         GridView1.DataBind();                                   //match columns from the DataTable to grid view columns (declared in source view)
     }
 }