Displaying User Specific Data (based on user input)
-
Hello, I have an ASP.NET website with a sql backend. I am utilizing the membership provider model within visual studio. The site can only be accessed by entering the correct username and password. I have approximately 20 pdfs on the website. I need to be keep a log of who has "read" which documents. I am creating a page that lists all documents to be read. I have a check box before each url. The user will need to check off which documents he/she has read and then submit the page. When the user clicks on the link again to see the remaining documents to be read, the page should only display those documents that the user has not yet checked off. I can store the document list in a sql database but I am not certain how to maintain the log of documents for each user and how to only display the list of those documents that have not yet been read. Any thoughts or assistance would be appreciated. Also if there is more efficient way to do this please let me know. Thank you in advance for your assistance. Allison
This sounds messy to me. If I check an item, it disappears from the list ? I would have thought you would allow users to request a document they have viewed before, and that you'd track what they read automatically, through what documents they requested from your system. I would expect you're going to store in the DB which ones were marked read, then run SQL to request the unread ones to view.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
This sounds messy to me. If I check an item, it disappears from the list ? I would have thought you would allow users to request a document they have viewed before, and that you'd track what they read automatically, through what documents they requested from your system. I would expect you're going to store in the DB which ones were marked read, then run SQL to request the unread ones to view.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian, Thanks for your quick reply. You bring up a good point, I see that I probably did not clarify this as well as I should. The list of documents that need to be read is a separate page that serves as a central location to store all those documents that still need to be confirmed as being read (by the user). This list contains the name of the document, a link to the document and checkbox that is to be checked once the document is read. The documents are located on a variety of pages throughout the site. Hopefully that helps. Sorry for the initial confusion. Allison
-
Christian, Thanks for your quick reply. You bring up a good point, I see that I probably did not clarify this as well as I should. The list of documents that need to be read is a separate page that serves as a central location to store all those documents that still need to be confirmed as being read (by the user). This list contains the name of the document, a link to the document and checkbox that is to be checked once the document is read. The documents are located on a variety of pages throughout the site. Hopefully that helps. Sorry for the initial confusion. Allison
OK - I still think that you should be detecting when a document is requested, and marking it as read as a result, and letting the user view ALL documents in order to select which ones to mark as read ( so they can unmark some ). From there, if you have them marked as read in the DB, it's easy to write SQL that returns the list of unread documents, so you can display that.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
OK - I still think that you should be detecting when a document is requested, and marking it as read as a result, and letting the user view ALL documents in order to select which ones to mark as read ( so they can unmark some ). From there, if you have them marked as read in the DB, it's easy to write SQL that returns the list of unread documents, so you can display that.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Christian, Thanks that makes perfect sense, however (per the requirements provided to me), I need for the user to actually check a box or something to confirm that they have read the document. I really appreciate your help. Allison
Has anyone gone over the requirements with the client, or are they allowed to invent anything and you're not allowed to offer feedback ? In any case, you can do this easy enough, just define a column that has a checkbox in a gridview that you display, then check which ones were checked, on postback. http://www.codeproject.com/info/search.aspx?artkw=gridview+checkbox[^] There seems to be a lot of CP articles on how to use checkboxes inside a gridview, I'd say you need to start there. It's a while since I've done this sort of thing, and I am sure that an article with downloadable code will help you more than any comments I might make in a forum reply.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Has anyone gone over the requirements with the client, or are they allowed to invent anything and you're not allowed to offer feedback ? In any case, you can do this easy enough, just define a column that has a checkbox in a gridview that you display, then check which ones were checked, on postback. http://www.codeproject.com/info/search.aspx?artkw=gridview+checkbox[^] There seems to be a lot of CP articles on how to use checkboxes inside a gridview, I'd say you need to start there. It's a while since I've done this sort of thing, and I am sure that an article with downloadable code will help you more than any comments I might make in a forum reply.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hello, I have an ASP.NET website with a sql backend. I am utilizing the membership provider model within visual studio. The site can only be accessed by entering the correct username and password. I have approximately 20 pdfs on the website. I need to be keep a log of who has "read" which documents. I am creating a page that lists all documents to be read. I have a check box before each url. The user will need to check off which documents he/she has read and then submit the page. When the user clicks on the link again to see the remaining documents to be read, the page should only display those documents that the user has not yet checked off. I can store the document list in a sql database but I am not certain how to maintain the log of documents for each user and how to only display the list of those documents that have not yet been read. Any thoughts or assistance would be appreciated. Also if there is more efficient way to do this please let me know. Thank you in advance for your assistance. Allison
Hi Allison,
ahayw01 wrote:
I have a check box before each url. The user will need to check off which documents he/she has read and then submit the page.
This is not a good idea in my opinion. Document will be still shown in the documents to read area when user reads the documents and not check off the check box. Automating this would be a nice idea. You can make use of a Http handler and hook one for PDF extension. You only need to show the PDF link to the user without any check box. When user clicks on a PDF file link, this handler will be executed and it will do the logging.
ahayw01 wrote:
I can store the document list in a sql database but I am not certain how to maintain the log of documents for each user and how to only display the list of those documents that have not yet been read.
You may need two tables. One for storing the available documents and one for logging the users read activities. Here is a sample.
Master table - Documents - DocumentId - A unique id to identify each document - DisplayName - Text displayed to user - PDFFileName - PDF file name Transaction table - UserReadActivity - UserId - DocumentId - Foreign key referring Documents table
You can easily get all the documents that a user has to read by using the querySELECT *
FROM Documents
WHERE DocumentId Not IN (SELECT DocumentId FROM UserReadActivity WHERE UserId = YourUserId);It will be good to show the documents that are already read if user is allowed to reread. It can be achieved by joining the both tables. Hope that helps. :)
Navaneeth How to use google | Ask smart questions
-
Hello, I have an ASP.NET website with a sql backend. I am utilizing the membership provider model within visual studio. The site can only be accessed by entering the correct username and password. I have approximately 20 pdfs on the website. I need to be keep a log of who has "read" which documents. I am creating a page that lists all documents to be read. I have a check box before each url. The user will need to check off which documents he/she has read and then submit the page. When the user clicks on the link again to see the remaining documents to be read, the page should only display those documents that the user has not yet checked off. I can store the document list in a sql database but I am not certain how to maintain the log of documents for each user and how to only display the list of those documents that have not yet been read. Any thoughts or assistance would be appreciated. Also if there is more efficient way to do this please let me know. Thank you in advance for your assistance. Allison
Create a log table that has it's keys setup to be the userid and the documentid. When they click on the submit button, loop through the checkboxes and add a value (check for duplicates) into this log table. Then, just run a simple query joining your document table with the log table to get those records that have not been viewed. This is pretty basic coding, so if this is above your head go to the library and get a decent book, there will be many examples on this type of question.
-
Create a log table that has it's keys setup to be the userid and the documentid. When they click on the submit button, loop through the checkboxes and add a value (check for duplicates) into this log table. Then, just run a simple query joining your document table with the log table to get those records that have not been viewed. This is pretty basic coding, so if this is above your head go to the library and get a decent book, there will be many examples on this type of question.
-
Hi Allison,
ahayw01 wrote:
I have a check box before each url. The user will need to check off which documents he/she has read and then submit the page.
This is not a good idea in my opinion. Document will be still shown in the documents to read area when user reads the documents and not check off the check box. Automating this would be a nice idea. You can make use of a Http handler and hook one for PDF extension. You only need to show the PDF link to the user without any check box. When user clicks on a PDF file link, this handler will be executed and it will do the logging.
ahayw01 wrote:
I can store the document list in a sql database but I am not certain how to maintain the log of documents for each user and how to only display the list of those documents that have not yet been read.
You may need two tables. One for storing the available documents and one for logging the users read activities. Here is a sample.
Master table - Documents - DocumentId - A unique id to identify each document - DisplayName - Text displayed to user - PDFFileName - PDF file name Transaction table - UserReadActivity - UserId - DocumentId - Foreign key referring Documents table
You can easily get all the documents that a user has to read by using the querySELECT *
FROM Documents
WHERE DocumentId Not IN (SELECT DocumentId FROM UserReadActivity WHERE UserId = YourUserId);It will be good to show the documents that are already read if user is allowed to reread. It can be achieved by joining the both tables. Hope that helps. :)
Navaneeth How to use google | Ask smart questions
Navaneeth, Thanks for your response. The solution that you proposed is great and automating this makes perfect sense. Unfortunately, I need to be able display the list of documents that need to be read and have the user check the box, confirming that he/she has read the document. I am sure I will be able to use what you proposed in my future projects. Thanks again, Allison