Link to home
Start Free TrialLog in
Avatar of bolenka
bolenka

asked on

How do I prevent the updating of a record from removing my record from the current datasource dataset for paging purposes?

Ok, prairiedog was nice enough to help me with my last question...but, now i have a related question to the same problem.

I have a Content Page that contains a formview. I have a quiz application that updates the status of the record to COMPLETED when the user answers the quiz question. I want to show the correct answer on a resutls page for the quiz and some teaching points AFTER the user chooses an ANSWER which is  AFTER the UPDATE button has been clicked (this is how my client wants it to work). However, when I update the record and change the status to COMPLETE in the database, it looks like the record is being taken out of the original query because in my original query I am asking the database to show only records that have NOT YET BEEN COMPLETED.

1) I need the records to page...ONLY AFTER the user has updated a record to COMPLETE in the database can the "Next Question" pager item be displayed...meaning, I only want the user to be able to page to the next record once they have answered the question and seen the results of the current question.

2)I am working in a formview with an item template and and edit template. The edit template calls a stored procedure to do the update(templates are in a Formview, Formview is in a ContentPage of a MasterPage.

3) Right now, I am currently trying to change the mode after UPDATE to only show the READONLY template version of the result s PAGE, but since the record gets removed from the datasource, it actually sets the readonly mode of the NEXT question(since it is actually paging to what is now the first record in the datasource dataset...so instead of showing my results on the results page of the question I want, it is showing the answer to the next question instead.

So to sum up, how do I keep the record in the dataset, so that I can change the mode from EDIT to READONLY, allowpageing only on a results page of the current record I am working on without removing the record from the dataset, or screwing up my page count?

Thanks so much.

I hope this make sense. I really am desparate. Please help
I have been working on this issue for days!!!
P.S. I am coding in VB.net so if at all possible, please post answers in vb.net:)
Avatar of prairiedog
prairiedog
Flag of United States of America image

>>>want to show the correct answer on a resutls page for the quiz and some teaching points AFTER the user chooses an ANSWER which is  AFTER the UPDATE button has been clicked.
Have you got this part worked out as far as how to get the data from DB?
Do you want to display the correct answer no matter if the user's answer is correct or not?
After review the results, does the user have to click a button or something to go to the next question?
Avatar of bolenka
bolenka

ASKER

Hi prairiedog:) Again:) To answer your question:
1) I am already using a sqldatasource to get the data. It is a select statement the gets the select * from... where CollectionID=@CollectionID and Completed = 0. For the update statement within the sqldatasource, I am using a stored procedure (mainly because I have to update some data in some other tables at the same time) to set the Completed Column for that record to Completed= 1. Radiobuttons, not a RadIobuttonList, are bound to answer options in the content page manually (there are 15 different choices the user could make for each question i.e. 15 columns) belonging to that question/record ID. Each record/question to answer in the db has all the available columns that are needed to get the data and to make the update. In otherwords, questions come from the same record as the Answers.
The user clicks a radio button to choose an answer and then clicks the update button..."Submit Answer" at the bottom of the form to submit the answer they have just clicked. At this point I need the user to see the results WITH PAGING.
Do I need something else? included in the sqldatasource?

2) Yes, I HAVE to display the correct answer no matter if the user's answer is correct or not. I have to display the correct answer in green text with a little checkbox image if the answer is correct, and I have to display a little "X" image if the answer is wrong. I also have to provide some percentages/statistics next to the radio button answer:

"88% of people chose this answer"
"12% of people chose this answer"

I have to display this data next to each answer item..whether correct or incorrect.(this data will be calclulated from the same table based on all user answers in the table (havent finished that part yet)
Teaching Points and other information about the answer will appear on the results page with the correct answer and corresponding images.

3) After viewing the results, the user has to click on a link that says "Next Case" (meaning next question), to move onto the next record. Once the next record has been clicked, the user has to see the next question in edit mode, and then the results for that question in Readonly mode (this is just the way I have it coded with the templates now)

4)Once all the questions in the query have been set to complete, the user is done with the collection of questions/cases and I have to insert a CollectionCompletedDate Date value into the the collectionCompleteddate column of the same record/question.

Does that help?

Do I have to use a sql datasource? or object datasource. I have no objections to getting the data another way. I started this not really knowing the best way to get the data. I am using table adapters for other purposes in other parts of the application. What is the best way to get the data onto the form?
I am open to suggestions.

Let me know if you have any more questions. You are saving my life!!!! Really...thank you.

What control do you use to display the correct answer and other stats?
Avatar of bolenka

ASKER

I was just using a panel control with some labels in it. I make the whole panel visible after submission.
Avatar of bolenka

ASKER

prairiedog? have I lost ya?
Avatar of bolenka

ASKER

do you think you wil answer this or should I repost? thanks so much?
Hi bolenka,

I don't get on-line on Saturdays as much as I do during week days.  Besides, your question is kinda tricky and I need some time to think about it before I can give you a solid answer. I don't think you need to repost. If you can't wait until Monday, you can click "Request Attention" button located at the right lower corner of your original question post, so some advanced experts will be notified of this question and they should be able to help you. I am sorry that I didn't reply to you early.

Jeffrey
Avatar of bolenka

ASKER

no problem...I would love for you to help me...can you take a look on monday to see if it has been answered? thank you so much. I will click request attention just to see if someone else answers and then follow up on monday? I appreciate it.
Hi bolenka,
I am sorry I didn't come here yesterday because my son was sick.
Anyway, I have come up with a solution but it is a little bit different from your requirements. I don't think you can keep the updated record after the "UPDATE" button is clicked and you know the reason.
Based on your current situation (you are using a Panel to display the original question and user's answer and other stats), I have come up with a solution. Here is how it works:
By default, the Panle is invisible, and when the "UPDATE" button is clicked, the record will be updated, the Panel will be visible with the original question and user's answer and other stats. In the Panel, there is a button called "Next Question". With some CSS tricks, we can make the Panel on top of the FormView layer, and the Panel will have a black background so user will not be able to see the next question until they hit "Next Question". Once the button is clicked, the Panel become invisible again, and the user is able to see the next question in READONLY mode.
Please refer to the attached screen shots and let me know if it is an acceptable solution. If yes, I will post the code and the CSS (I used the AdventureWorks2000 DB for my example).

2008-10-28-092604.jpg
2008-10-28-092858.jpg
2008-10-28-092944.jpg
Avatar of bolenka

ASKER

holy moly..what a great idea!..thanks so much prarie dog...let me get my brain wrapped around it and I'll get back to you.  I had not even thought of a solution like this. Very creative. I truly appreciate it. Thanks for responding. I certainly understand having sick children. been there:) I will analyze and get back to you.
Avatar of bolenka

ASKER

Hi prairie dog...I have thought about your suggestion, and I would really like to try it Any code you could send me including the .css would be fantastic...then I can assign points:)
ASKER CERTIFIED SOLUTION
Avatar of prairiedog
prairiedog
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bolenka

ASKER

thanks prairiedog...I'll take it. I hope you answer more of my questions in the future. You have been really helpful!