Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Adding DotNet Variables to Javascript URL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elmo Watson - 18 Dec 2007 16:41 GMT
I've got this Javascript HREF:

<a
href="javascript:void(window.open('print_Mileage.aspx?id=<%#sID%>&emp=<%#sEmp%>'))">Printer
Friendly Page</a>

The variables sID and sEmp are populated when the page loads. However when I
hover over the link for this, the variables are not populated in the
querystring.
I tried doing a Page.Databind at page_load, but I had an erroneous error
that only disappeared once I removed the line.

I know I've done this before, but I can't remember how - - - - What am I
missing here?
Mark Rae [MVP] - 18 Dec 2007 16:48 GMT
> I know I've done this before, but I can't remember how - - - - What am I
> missing here?

# is Databinding shorthand... If you don't want to use that, you need to
use:

<a
href="javascript:void(window.open('print_Mileage.aspx?id=<%=sID%>&emp=<%=sEmp%>'))">Printer
Friendly Page</a>

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Cowboy (Gregory A. Beamer) - 18 Dec 2007 17:06 GMT
One option, that gives you full control, is to bind in code behind. To do
this, use a hyperlink control instead of an anchor <a href>. It will create
the ifno for you.

If this is part of a grid, you can set up the hyperlink control in the grid
and use the designer to add the information to the URL string.

Signature

Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************

| Think outside the box!

*************************************************
> I've got this Javascript HREF:
>
[quoted text clipped - 10 lines]
> I know I've done this before, but I can't remember how - - - - What am I
> missing here?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.