Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP generated link, perform sub with arguments

Status
Not open for further replies.

markronz

IS-IT--Management
Mar 20, 2007
93
US
I am very new to HTML, ASP, and Javascript, so please be patient with me. I am wondering the best way to do something. Let me see if I can adequately explain.

I have a existing web page that using ASP is generating a table for me. It's querying a database and printing out the information in table format. The data is actually showing logs of emails that were sent. This table mostly just displays information which need no further explanation, such as date, subject, etc... There is one column which does need further explanation however. It's the recipient list column. We make use of "groups". So what is CURRENTLY being displayed in the table is something generic like "MarketingGroup". The information as to who is actually in the "MarktetingGroup" is contained in a totally different database. I'd like the user to be able to click on the words MarketingGroup contained in the table, either as a link or a button, whatever you think is easiest, and have it, at that time, go out and query this other database and show the user the contents. I don't want it to look up every group ahead of time as this data table might have hundreds of rows in it and I don't necessarily NEED explanation of the contents of each group. So I would only want it to query the other database and find the group contents when the user clicks on it.

What I've done is create two <div>'s on my page. One with the main results table, and another one that I'd ideally like to use to display the contents of the group that was just clicked on. So right now, I have the group column set to be a link. So it would generate (via my ASP) something like this:
HTML:
<td class='cell'><A id = 'displayText' HREF = '#' onclick='return hideDiv();'>MarketinGroup</A></td>
And my javascript simply hides one div and displays the other:
<script type="text/javascript">
JavaScript:
function hideDiv(str) {
	document.getElementById("ResultsDiv").style.visibility = "hidden";
	document.getElementById("AlertGroupResultsDiv").style.visibility = "visible";
} 
</script>
So that's all well and good. It does hide my original div that has my main table on it, and it shows the other div. But I'm struggling with how to do the rest. What is the best way for me to do this? I need to be able to click on the link, or button that's generated via the ASP, and have it at that time look up the information from the other database. So it seems like I need to get the html for the MarketingGroup for example call a sub. That sub would query the database and populate the AlertGroupResultsDiv <div>. Then I need it to hide the one div and show the other (like my javascript does above).


Any idea how I can do this? Do I want the column for the group (like MarketingGroup) to be a button? How can I get the button to call a Sub, and pass along the group name it's for? Sorry if this is confusing. I'm having a hard time explaining it, let alone coding it...
 
Well I'd say your looking at either an iframe or AJAX.

As I said in the other thread:
thread215-1694738

You can send the value through the query string to the popup div. Its quite trivial if you use an iFrame, and only marginally more involved if you use AJAX.

HTML:
<div class="AlertGroupResultsDiv">
<iframe id="theResultsFrame" src="" width=100% height=100%>Loading...</iframe>
</div>

Code:
<A id = 'displayText' HREF = '#' onclick='return hideDiv(<%=IDvariable%>);'>MarketinGroup</A>

Code:
function hideDiv(thevaluetosendover) {
	document.getElementById("ResultsDiv").style.visibility = "hidden";
[tab][tab]document.getElmentById("theResultsFrame").src = "aspdbsearchpage.asp?idvalue=" + thevaluetosendover;
	document.getElementById("AlertGroupResultsDiv").style.visibility = "visible";

}

Your ASP can populate the IDVariable variable with the ID of the row you need to fetch the data for.
JS then alters the source of the iframe inside the hidden div to run a specified ASP page that can query the database with the parameter it gets in the query string.
The iframe simply show what the new ASP page produces.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Vacunita solution is certainly the same one I was thinking about, however, the wider question here is about information management, the current membership of any group may not be the same as the membership when the message was sent, due to joiners and leavers, as such, which list of members do you want - the one now or the one at the time the message was sent ?

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
That's incredibly observant of you ggriffit! And it's the reason I can't simply have the web page display the contents of the group. I am trying to either bring up a new page or display a different pane/div so that I can put a disclaimer at the top that says something to that effect. That the groups contents are the current contents and may differ from the time the message was sent. There is no log or anything else that captures the actual recipients as the message is truly sent. But the users still felt it was valuable to see who's in the group now. But i felt it was still important to display a warning at the top.

In any case, thanks for the help you two. Short answer is that this is not as simple as I'd hoped it would be. I'm going to look into an iFrame to start. I'll let you know when (ha!) I run into problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top