Problem with XML vs Dataset

A

Ariana

Hello,

I have a problem and I'm hoping it will ring a bell with someone here. :)

In my ASP.NET website, I have a custom calendar control which highlights
ranges of dates based on a data source, and also allows a new date range to
be selected. To select a new range, the user clicks on the first date, then
clicks on the second date. The selected range is then highlighted, but the
dates from the database are still highlighted as well. This all worked fine
when I used an Access database through a typed Dataset.

However, I have now switched to an XML file read into a new Dataset in the
Page_Load event. Everything is fine until the user clicks on the second
date - the ranges in the database are highlighted, and when the user clicks
the first time, the date they picked is highlighted too.

But when they click a second time, the range they have selected is
highlighted, but all the dates from the data source are blank. Indeed,
stepping through the code reveals that the calendar's data source suddenly
has no data in it when the second click is processed.

I'm thinking that there might have been some caching going on with the typed
dataset, but I'm not sure how to fix the problem now I'm using an XML file.

Obviously, unless this summary already rings a bell, you will need to see
the code to help me, so I'm happy to provide the entire ASP.NET project. I'd
be very grateful for suggestions!

Thanks!
 
J

John Saunders [MVP]

Ariana said:
Hello,

I have a problem and I'm hoping it will ring a bell with someone here. :)

In my ASP.NET website, I have a custom calendar control which highlights
ranges of dates based on a data source, and also allows a new date range
to be selected. To select a new range, the user clicks on the first date,
then clicks on the second date. The selected range is then highlighted,
but the dates from the database are still highlighted as well. This all
worked fine when I used an Access database through a typed Dataset.

However, I have now switched to an XML file read into a new Dataset in the
Page_Load event. Everything is fine until the user clicks on the second
date - the ranges in the database are highlighted, and when the user
clicks the first time, the date they picked is highlighted too.

But when they click a second time, the range they have selected is
highlighted, but all the dates from the data source are blank. Indeed,
stepping through the code reveals that the calendar's data source suddenly
has no data in it when the second click is processed.

I'm thinking that there might have been some caching going on with the
typed dataset, but I'm not sure how to fix the problem now I'm using an
XML file.

Obviously, unless this summary already rings a bell, you will need to see
the code to help me, so I'm happy to provide the entire ASP.NET project.
I'd be very grateful for suggestions!

Are you loading the XML file only when IsPostBack is False? Otherwise,
you'll be loading the old data over the new.
 
A

Ariana

John Saunders said:
Are you loading the XML file only when IsPostBack is False? Otherwise,
you'll be loading the old data over the new.

Thanks for the suggestion, but that doesn't seem to be the problem. The XML
file is actually loaded with every page refresh - no check for post backs.
However, the XML file is never modified - the user-highlighted range is just
stored in a member variable - so the data from the XML file will always be
the same. The code to load the data runs at every refresh, including the one
that wipes out the data. So I'm still not sure why the data source suddenly
has no rows when the user clicks a second time. :-/

But thanks for taking the time to respond.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top