4 Replies - 579 Views - Last Post: 19 February 2015 - 02:41 PM Rate Topic: -----

#1 stilllearning1820   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 24-January 15

Want to show text from database depending on what a user selects

Posted 19 February 2015 - 01:59 PM

Hi, I am working on a basic project that involves a posting system. I have created log in and registration pages, and am now working on the posting page.

Let's say I have a page called PostList.aspx that lists that shows all the available posts you can look at, all of which are stored in a database (ADO.NET Entity, MS-SQL).

Then let's say I have a ViewPost.aspx where if a user clicks on one of the available posts in PostList.aspx, it will show that specific post on ViewPost.aspx.

What would be the best way of going about this? Would I/could I create a variable in PostList.aspx.cs that I pass over to ViewPost.aspx.cs which can then query the database(LINQ) to show that specific post?

Is This A Good Question/Topic? 0
  • +

Replies To: Want to show text from database depending on what a user selects

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15300
  • View blog
  • Posts: 61,364
  • Joined: 12-June 08

Re: Want to show text from database depending on what a user selects

Posted 19 February 2015 - 02:02 PM

Yes.. you would probably have your post ID you would feed to a database query that would return the specific information.
Was This Post Helpful? 1
  • +
  • -

#3 stilllearning1820   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 24-January 15

Re: Want to show text from database depending on what a user selects

Posted 19 February 2015 - 02:05 PM

Would that be via string in the URL or another means? I've been told request strings typically aren't favored anymore as a way to pass information, is there any good way in particular I could read up on or take a look at?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15300
  • View blog
  • Posts: 61,364
  • Joined: 12-June 08

Re: Want to show text from database depending on what a user selects

Posted 19 February 2015 - 02:07 PM

Session variables, events, etc. There are multiple ways to translate user interaction on an specific id to the code behind use.
Was This Post Helpful? 1
  • +
  • -

#5 demausdauth   User is offline

  • D.I.C Addict
  • member icon

Reputation: 190
  • View blog
  • Posts: 692
  • Joined: 03-February 10

Re: Want to show text from database depending on what a user selects

Posted 19 February 2015 - 02:41 PM

Query string is probably the easiest way.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1