Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-19-2002, 10:48 AM   PM User | #1
pthompson2002
New Coder

 
Join Date: Aug 2002
Location: Ipswich
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
pthompson2002 is an unknown quantity at this point
Exclamation displaying data from a database into a div tag

I have a scrolling textarea which scrolls the title column from a table. They inform people of meetings, events etc. For example a title may read "meeting on 3rd of December". When the use clicks on one of these titles I would like the contents of the message column from the same table to be displayed. this column gives the user more info on the event/meeting.
I would like the content to be displayed in a div tage underneath the scroller.
My problem is, I'm not sure how to retrieve the contents of the message column into the div tag. I know all the SQL I will need to use and know how to set-up div tags but what do I need to do to get it to work when the user clicks the link?

Any help would be appreciated.

Pete
pthompson2002 is offline   Reply With Quote
Old 08-19-2002, 01:45 PM   PM User | #2
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
i'm not sure I understand your problem.
i suppose you want the info to be displayed in a floating box when the user selects an item in your text area.

now, i never used this because the selecting and showing of the info then completely runs on the users PC (you drag the floating box in when the user makes his selection) and you need to send all that info when the page originaly loads. i would work with two pages (into one frameset to make it look like one page):
- one with all the items from the title colum;
- one where the info will be displayed .

with an 'action=info.asp target=page2 onclick:submit();' statement in the form-tag of the first page, you can than activate the asp page where the select-statement to retrieve the info is run, and then display this info in the second frame (page2).

i think it's possible to do the floating-box trick, buth i don't think it's the best way to go. i just tried it with one floating box, and it took me some time to generate the correct html

hope this helps you a bit further
raf is offline   Reply With Quote
Old 08-19-2002, 02:52 PM   PM User | #3
pthompson2002
New Coder

 
Join Date: Aug 2002
Location: Ipswich
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
pthompson2002 is an unknown quantity at this point
I can't seem to get that to work. Does the onClick go in the form tag?
pthompson2002 is offline   Reply With Quote
Old 08-19-2002, 03:20 PM   PM User | #4
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
sorry. my mistake. it should be in tag of the form-element. if you would use a listbox, it would be something like
<select id="select1" name="sorts" size="10" onclick="submit();">

(it's probably wiser to use a list box than a text area. if you do use a text area, you could just as well show a collection of links and puth the selection-condition in the querystring. Like that, you don't need a form and the onclickj etc

example code:


do while rsLinks.EOF=false
Response.Write("<a href=info.asp?InfoID=")
Response.Write(rsLinks.Fields("name_of_varible_with_InfoID)
Response.Write(" target='page2'>")
Response.Write(rsLinks.Fields("name o variable with text for link"))
Response.Write("</a> ")
response.write("<br>")
next


rsLinks is the recordset you now use to make your first selct. info.asp is the asp where you select the extra info-text to display in the page2-frame in the same window. InfoID is the concition you use in the select on info.asp .
raf is offline   Reply With Quote
Old 08-19-2002, 03:37 PM   PM User | #5
pthompson2002
New Coder

 
Join Date: Aug 2002
Location: Ipswich
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
pthompson2002 is an unknown quantity at this point
I've realised that I'm not using a textarea at all. I have the titles scrolling through div tags. Will that example still work?
pthompson2002 is offline   Reply With Quote
Old 08-20-2002, 08:23 AM   PM User | #6
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
well, first of all : the example code from my last post generates a list of links with the content of your title-colom in it (seperated by a break between each link.) when you click one of them, it calls for the info.asp page and takes an ID with it in the querystring.
(if both the title and content are in the same table, and there is aan ID in this table, say "messageID", you could pass this ID along via the querystring. just replace the "name_of_varible_with_InfoID" then by this "messageID"

if you try it out, and you look at the code when you browse the page, you wll see it generates straigth html (as asp always does).


you can generate this linklist into a floating box by placing this code between the div-tags. (as if you would insert it manually)

i don't know about your scrolling part. how do you make them scroll ? i suppose you use a small script to let the content of the floating box scroll, so i expect it would still work with this generated list.
raf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:57 PM.


Advertisement
Log in to turn off these ads.