User Profile & Activity

Eric Member
Page
of 19
Posted: August 10, 2011 8:07 AM
Hi Riendy,

The problem on the web farm is now gone, but the application is not working anymore.

On that page we have two grids. The main WebGrid is hierarchical with dynamic loading of subnodes. We are using the recommended way (see the other thread) to load the data in InitializeDataSource. When opening a node, dynamically the data in that node will get loaded. In InitializeSelfReferenceDataSource I call e.ParentKeyValues to get the parent value and load the node data and merge it into e.DataSource with .Merge(ds.Tables(0), True, MissingSchemaAction.Error).

After turning off this AllowAutoDataCaching feature, I noticed two new problems:

a) Opening the first level nodes works, but any level deeper does not work. In InitializeSelfReferenceDataSource the data seems to get added correctly, but it just doesn't get displayed. I'm still debugging this.

b) When selecting and row in a subnode and then clicking on a row in the second WebGrid, a client-side js event gets called, which posts back by calling grdMain.SendCustomRequest. On the server-side this goes into the wg2.InitializePostBack event. There I access what was selected in the first grid: CType(grdMain.DataSource, DataTable).Select("ID="...). The problem is now that the data isn't there anymore, the row is missing. When a row in the root is being selected it works, but not if a row is selected which was added by InitializeSelfReferenceDataSource event. Before turning off the AutoCache it worked.

The problem b) is only for the server-side, on the client the folders are all there and nothing disappears. Do I have to cache this data myself somehow? Or what is the idea here?

Regards,

Eric

Posted: August 5, 2011 4:55 AM

Hi Riendy,

Thanks for your reply. I found the documentation of the AllowAutoDataCaching property. From the documentation it does a caching of the DataSource object and is enabled per default. As all grids we use get refreshed with different data on every click, we might change this to False everywhere anyway.

But from the description it also says that the caching feature is not being used automatically and instead we should use IsDataCached property before querying for new data. We are not doing that, so I assume we don't use the caching feature anyway. Also, the description says the cached data is stored in the Session object and that is stored in SQL-Server session handler database, so it's not webserver specific.

I'm looking for some reason why the data is only on one server and not shared or not refreshed properly. So this property would not explain the problem.

Any other ideas? Any known bugs?

Regards,

Eric

Posted: August 5, 2011 4:42 AM

Hi Riendi,

Back from vacation now. Yes, I do know the information in that article. We've set the machine key in the web.config and use session state on SQL-Server.

Eric

Hi Handy,

Did you mean this event list?

  1. WebGrid_PreInitialize
  2. WebGrid_Initialize
  3. Page_Load: Event loading of the current page
  4. WebGrid_InitializeLayout: Layout initialization such as assigning static behavior, appearance and styles
  5. WebGrid_InitializeDataSource: Data source initialization
  6. WebGrid_PrepareDataBinding: Column structure retrieval and creation of necessary objects
  7. WebGrid_Load: Indication of successfully preparation of data binding process and data populatingin all rows
  8. <<ServerControl Events>> - if Page.IsPostBack: Execution of server control events such as Button1_Click
  9. Page_PreRender
  10. ...
  11. WebGrid_Load
  12. WebGrid_PreRender
  13. ...
  14. Page_SaveViewState
  15. Page_Render
  16. ...
  17. WebGrid_InitializeTable
  18. WebGrid_InitializeColumn
  19. WebGrid_InitializeRow
  20. WebGrid_InitializeCell
  21. ...
  22. WebGrid_Unload
If yes, I do know this very well, but it just lists the order, nothing else; no description. And also I expected to have this on your homepage (like earlier) and not only installed with the product somewhere.

And for the Control.PreRender event the (Microsoft) description only says:

Occurs after the Control object is loaded but prior to rendering.

Use this event to perform any updates before the server control is rendered to the page. Any changes in the view state of the server control can be saved during this event. Such changes made in the rendering phase will not be saved.

That's not really much information, as you write as well. So yes, please update the documentation (and put it to your homepage too).

Thanks, Eric

Hi Handy,

Thanks for your feedback. This workaround looks much better. The original sample doesn't crash anymore when doing the same things. I have to test if anything else doesn't work anymore though, which might take some time, but from this change I don't expect any such problems.

So to summarize this in short: In the PreRender event it is forbidden to touch the grd.RootTable columns, or at least it is not reliable to touch them as they can disappear because they internally get overwritten by client content at this stage.

Is this behaviour documented somewhere? If not, please describe this in the PreRender event. Can you also add a link to that description in this thread please?

Thanks, Eric

Hi Handy,

I looked at your code again. You moved the column creations from .Init to .PrepareDataBinding and added a RootTable.Columns.Clear before the creation. You also moved the footer code from the Page.Load to the grdLower_PrepareDataBinding. But the main change is that in SetColumnVisibility you check if column D exists and if not you just create it.

This can't be your proposed solution, right? If you create the columns and then later when you use them, one column suddenly disappears, you just recreate it? And then you tell me this was a bug in my code and not in your product?

Please fix this bug instead of providing me non-working workarounds.

Thanks,

Eric

Hello Handy

There is no error in the code. I know that the column "D" is null. This is the bug. I want that the column "D" no longer randomly disappears. I am changing visiblity and stuff, but the column should always be accessible by servers-side code. The column may disappear on the client-side if it is not visible though, but never on the server-side.

In your new sample you modified the code. I do know that it is possible to write different samples that do work. But it is not the same sample anymore. We could now get into long discussions about requirements etc. but I just want the original sample to not crash anymore -  with the unchanged code. (Or show me where I programmed something violating your specification. Point me to the documentation to what I didn't obey in this case.)

We had those requirements discussions already and finally you confirmed that it is a bug. Please read the thread again if you need to recall. I have a (bad) workaround already, but I need this bug fixed. Thanks.

Posted: June 10, 2011 3:43 AM

You know that you can never test on a production system. And reproducing this is also not possible right now as you know.

So the only thing we can do is to add some logging to find out more details (which might lead to a reproduction scenario or whatever). But you never told me what you need.

I understand that this bug is not very important for you, as this happens currently only for us and only randomly every few weeks and on an old server - together with your limited resources. But it is still a very drastic bug and might still exist on any newer server for any client you have.

So please let me know how to go on. If you don't want to fix it, please tell us this clearly too. Just letting us wait and telling things about reproduction is no option.

Ok, so please update this thread when this bug is fixed or when you know when this gets fixed.

Ok, please update this thread when the bug is fixed or when you know when it will get fixed.

All times are GMT -5. The time now is 1:18 AM.
Previous Next