views:

183

answers:

1

Hello All,

I am working on an .net (C#) web application.

Recently a defect came my way that stated that when two users were logged into the application at the same time they both could not update values without one refreshing the page. When I looked into the issue I discovered that the author of the code has used static datasets. I changed the datasets to not be static and everything works great.

However, This issue spans many pages in the application and I must fix it everywhere. On some of these pages the application uses datasets to bind data to datagrids. The datagrids are populated with the information in the dataset and the footer contains some textboxes and an add button to add extra rows. Here is where the problem starts:

When the page was using static datasets and the user attempted to add a row through the interface everything worked fine. However, when I changed it to use datasets that were not static (they are loaded every time the page loads) and the user attempts to add a row, the code thinks that the textbox is empty (discovered when debugging even though I can see the text that I entered) and empty field validation fails and a message is displayed.

Can someone please tell me why on Earth this is happening? Why does it see the text when the dataset is static (the dataset NEVER populates the foot row) and not see the text when it is not static? Some insight would be awesome!

Thanks in advance!

+1  A: 

Turns out there was an issue with how the grid was binding.

The binding was occurring when the datasets were being instantiated. This means that every time the page loads the binding was occurring again and causing the text to be blank. This is weird considering the item command looked like it was executing before the page load, but the datagrid didnt like it anyway. I moved where the binding was occurring so that it only happens once when the page loads (and of course it happens when something is added to the grid).

This seemed to do the trick!

The Sheek Geek