![]() |
| |||||||
| Sponsored Links |
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
| Hi All, I have hyperlink for a recordset on my TestResults page like below, if records are returned it opens the page and displays page BOMResults in a new window: Code: <TD align=right><a href="//server/test/BOMResults.asp?ItemID=<%=rs("ItemID")%>" target="_blank"><%=rs("ItemDesc")%></a> </TD>
Code: If rs.EOF then
%>
<SCRIPT LANGUAGE="javascript">
alert('No BOM for your selection!');
window.close()
</SCRIPT>
<%
Response.End
End If
%>
|
| Sponsored Links |
|
#2
| ||||
| ||||
| Rather than use a JS alert -- why not build the page so it displays a friendly NO Records Found message in place of the usual results?
__________________ Wolffy ------------------------ Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary. |
| The Following User Says Thank You to Wolffy For This Useful Post: | ||
Rebelle (June 20th, 2008) | ||
|
#3
| ||||
| ||||
| I agree with Wolffy. JavaScript alerts are kind of tacky... and what happens if a user has a browser that either does not support JavaScript or has JavaScript turned off?
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.If you like it here...throw us a few bones to help support us. Join our Folding team: DeveloperBarn Folding |
|
#4
| ||||
| ||||
| [set offtopic on] Which begs the question I've never had the time (pronounced gumption) to research. Since ASP.NET makes extensive use of Javascript -- what if the client has JS turned off? |
|
#5
| ||||
| ||||
| Sorry just want to make sure I understand completely.... so I took out the javascript and replaced it with this: Code: Response.Write "No Records Found!" Thanks again! |
|
#7
| ||||
| ||||
| Quote:
|
|
#8
| ||||
| ||||
| Hmm..you would want the user to stay on the current page if the posted page has no data to display? Is that what you are looking for? |
|
#9
| ||||
| ||||
| Yes, TestResults page has the link, when the link is clicked, if records are returned it displays the BOMResults in a new window (so both pages stay open) but if no records, just notify there are no records (TestResults stays open). |
|
#10
| ||||
| ||||
| OK, I was looking for some code that did this, but I must have deleted it. What I was thinking was this. If your BOMresults page finds no records, it can execute a JS function in the TestResults page that could (for example) display the No Records Found alert and then just close. The visual result being that BOMResults just goes away. It was the snippet that does 'execute a JS function in the [opening] page' that I can't find. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|