Hello,I have two webgrid, depending on a checkbox, one is visible and the other one is not visible.However, the event DataBinding is hit for both grid all the time which is not good for the performance.When I debug my code I can see that it always go first to the databinding event and then to the "Checkchanged" event of my checkbox where I set the visibility of each grid to true or false.How can I prevent a grid from databinding?Thanks
If you don't want to databind WebGrid, you need to avoid doing three things:
Thanks for your quick answer.I tried not to use the grid's DataSourceID property at design-time and mannual set it up in the code behind in the page_load. But by doing that, my event initialirow can not find any reference to the columns.
For example e.Layout.Bands[0].Columns.FromKey("revlevel").Width = Unit.Pixel(10);This will create an error if I set up the DatasourceID in the code behindThanks
arnololo said:I tried not to use the grid's DataSourceID property at design-time and mannual set it up in the code behind in the page_load. But by doing that, my event initialirow can not find any reference to the columns.
Test to see what happens if you point the DataSource property of the grid to your data source in Page_Load, rather than setting the DataSourceID property to the data source's unique ID.
If this doesn't resolve your issue, I suggest you submit a support request so a Developer Support Engineer can investigate this. It will help us to resolve your issue more quickly if you include a concise, complete sample project that we can run and debug that reproduces the behavior you're seeing.