I'm almost finished with my first hierachical table, but there still one problem to solve. Since I'm using a dynamic sql that result different type of result (not the same structure - different field names and data), when i open for the first time the result is fine, but the second one to open with the structure of the first query.
I guess I just need to reset somehow the detail table wich now is configured to AutoGeneratedColumns and I'm using the ItemCreated Event of RadGrid to change the columns names.
Some part of the code that bind the data to Detail table.
Thanks.
I guess I just need to reset somehow the detail table wich now is configured to AutoGeneratedColumns and I'm using the ItemCreated Event of RadGrid to change the columns names.
Some part of the code that bind the data to Detail table.
protected void rg_test_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e) |
{ |
if (e.DetailTableView.Name.Equals("detail")) |
{ |
System.Data.SqlClient.SqlCommand comm = new System.Data.SqlClient.SqlCommand("[pr_rpt_user_detail]", |
new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["db_misa_conn_string"].ConnectionString)); |
comm.CommandType = CommandType.StoredProcedure; |
Hashtable values = new Hashtable(); |
e.DetailTableView.ParentItem.ExtractValues(values); |
comm.Parameters.AddWithValue("@id_user", Convert.ToInt32(Session["id_user"])); |
comm.Parameters.AddWithValue("@id_user_rpt", Convert.ToInt32(values["id_user_rpt"])); |
comm.Parameters.AddWithValue("@id_rate_control", Convert.ToInt32(values["id_rate_control"])); |
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(comm); |
DataTable dt = new DataTable(); |
da.Fill(dt); |
e.DetailTableView.DataSource = dt; |
} |
} |
Thanks.