Help...
I am trying to create a relatively simple (but generic) report page.
Eventually, it calls a stored procedure (defined dynamically) that may return one or more recordset(s).
For each recordset, I want to create a simple grid that I simply bind to my dataset.
The user specify one or more criteria and press a button, at which time I try to create my grid(s).
My code, called from within the Button Click method looks like this (phReport is a PlaceHolder control)
The Grid shows and contains the right columns BUT shows "No records to display".
Initially, I had left EnableViewState as default (true) for both the PlaceHolder and the dynamically created grid and it showed the records when pressing the button a second time (I suppose the rows were then coming from the ViewState somehow as it seemed to hold the data).
The various articles I found say to create the grid in the Page_Init event but mine need to respond to the button click...
Any idea what I am doing wrong, or what I should do?
Many Thanks
Eric
I am trying to create a relatively simple (but generic) report page.
Eventually, it calls a stored procedure (defined dynamically) that may return one or more recordset(s).
For each recordset, I want to create a simple grid that I simply bind to my dataset.
The user specify one or more criteria and press a button, at which time I try to create my grid(s).
My code, called from within the Button Click method looks like this (phReport is a PlaceHolder control)
| public void BuildAGrid(SqlDataReader reader) |
| { |
| RadGrid grid = new RadGrid {DataSource = reader}; |
| grid.EnableViewState = false; |
| grid.DataBind(); |
| phReport.Controls.Add(grid); |
| } |
The Grid shows and contains the right columns BUT shows "No records to display".
Initially, I had left EnableViewState as default (true) for both the PlaceHolder and the dynamically created grid and it showed the records when pressing the button a second time (I suppose the rows were then coming from the ViewState somehow as it seemed to hold the data).
The various articles I found say to create the grid in the Page_Init event but mine need to respond to the button click...
Any idea what I am doing wrong, or what I should do?
Many Thanks
Eric