Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
LinqDataSource and dataitem retrieval
posted

Hello,

I'm using the UltaWebGrid and attached it to a LinqDataSource. The data is displayed fine, but I have to manipulate some things depending on the values in de underlying dataitem. The UltraGridRow only returns a datakey. If I have to run a new query to select the dataitem for every row this is going to be quite costly.

The default ASP.NET GridView control keeps the DataItem available in the row, is something like that possible with the UltraGrid? If I was using an objectdatasource this wouldn't be a problem since that control keeps the values stored too. Unfortunately, the LinqDataSource isn't keeping records available as far as I know.

So to summarize: how can I retrieve the complete dataitem in the InitializeRow event?

Parents
No Data
Reply
  • 19308
    posted

    Jasper,

    The grid doesn't hold onto the underlying DataItem reference because that could have severe memory implications as your datasource grows.  Instead, it is recommended that bind any fields to the Grid that you may need to execute your business rules against.  You can hide the columns you don't want the grid to show and by setting the column to "ServerOnly" the data won't even roundtrip to the client.  In short, bind the grid to all columns you need values for, and then hide the ones you don't want in your display.

    -Tony

Children
No Data