Dear all,
I have a RadPanelBar with 10 RadGrid inside it's template items.
Each one of these Grids might have up to 10,000 record each.
For sack of performance I decided to make the grids fill with data only on the Panel Item click and in order to keep up the performance I unload the previously loaded grid.
The Issues is that when you click again on the panelbar non of the grids show any rows at all.
Here is my approach:
I place each grid in one of the item template inside the panelbar.
I attached EventHandler to their OnNeedDataSource where I load the data.
I create a method to unload the data from all the grids before filling any of them.
and the GetDataTable.
What do I missing here ...
Greetings,
Waleed
I have a RadPanelBar with 10 RadGrid inside it's template items.
Each one of these Grids might have up to 10,000 record each.
For sack of performance I decided to make the grids fill with data only on the Panel Item click and in order to keep up the performance I unload the previously loaded grid.
The Issues is that when you click again on the panelbar non of the grids show any rows at all.
Here is my approach:
I place each grid in one of the item template inside the panelbar.
I attached EventHandler to their OnNeedDataSource where I load the data.
| protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| LoadData(Grid1); |
| } |
I create a method to unload the data from all the grids before filling any of them.
| private void UnloadDataFromAll() |
| { |
| Grid1.DataSource = GetDataTable(""); |
| Grid1.DataBind(); |
| Grid2.DataSource = GetDataTable(""); |
| Grid2.DataBind(); |
| } |
and the GetDataTable.
| public DataTable GetDataTable(string query) |
| { |
| if (query == "") |
| { |
| return new DataTable(""); |
| } |
| String ConnString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString; |
| SqlConnection conn = new SqlConnection(ConnString); |
| SqlDataAdapter adapter = new SqlDataAdapter(); |
| adapter.SelectCommand = new SqlCommand(query, conn); |
| DataTable myDataTable = new DataTable(); |
| conn.Open(); |
| try |
| { |
| adapter.Fill(myDataTable); |
| } |
| finally |
| { |
| conn.Close(); |
| } |
| return myDataTable; |
| } |
What do I missing here ...
Greetings,
Waleed