private DataSet uniGrid_OnAfterRetrieveData(DataSet ds) { DropDownListTable.DataSource = ds; DropDownListTable.DataValueField = "ClassID"; DropDownListTable.DataTextField = "ClassDisplayName"; DropDownListTable.DataBind(); return(ds); }
//get the data to display in the chart according to the user selection private void GetData() { string connetionString = ConfigurationManager.ConnectionStrings["PPPConnectionString"].ConnectionString; //dropdownlist config --> select column's names using (SqlConnection con = new SqlConnection(connetionString)) { con.Open(); SqlCommand cmd = new SqlCommand("SELECT table_name FROM INFORMATION_SCHEMA.TABLES", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); DropDownListTable.DataSource = ds; DropDownListTable.DataTextField = "table_name"; DropDownListTable.DataValueField = "table_name"; DropDownListTable.DataBind(); con.Close(); } //dropdownlist config --> select column's names string tableName = DropDownListTable.SelectedValue; string cmdX = "SELECT * FROM INFORMATION_SCHEMA.columns as name where table_name = '" + tableName + "'"; SqlDataAdapter daX = new SqlDataAdapter(cmdX, connetionString); DataTable dt = new DataTable(); daX.Fill(dt); //load the columns' names in the list for the X axis DropDownListX.DataSource = dt; DropDownListX.DataValueField = "COLUMN_NAME"; DropDownListX.DataTextField = "COLUMN_NAME"; DropDownListX.DataBind(); //load the columns' names in the list for the Y axis DropDownListY.DataSource = dt; DropDownListY.DataValueField = "COLUMN_NAME"; DropDownListY.DataTextField = "COLUMN_NAME"; DropDownListY.DataBind(); }