codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  response.redirect within a heyperlink  Learner at 09:12 on Thursday, April 01, 2004
 

Hi,
I have 3 dropdown boxes that are triggered by pressing a hyperlink.
the selected values should go to next page by response.redirect.

I am using asp.net, vb and dreamwaver.
and I don't know how to place response.redirect part within the <a> tag and pass values to the other page...
Please remember, I do not want to use button as I have an other button in the page which is triggered by Enter key.

here is what I have:

<asp:DropDownList ID="oSkill" DataTextField="SkillType" />
<asp:DropDownList ID="oLocation" DataTextField="City" />
<asp:DropDownList ID="oJobType" DataTextField="JobType" />
<a....????????????need help here???>go</a>

And the response.redirect:

Response.Redirect("/forum/storedtestresult_oLocation_.html" & oLocation.SelectedItem.Text & _
"&oSkill=" & oSkill.SelectedItem.Text & _
"&oJobType=" & oJobType.SelectedItem.Text)


  Re: response.redirect within a heyperlink  Troy Wolf at 21:01 on Friday, April 02, 2004
 

I'm not sure what exactly you want to do, but I don't think your issue is a .Net related problem. I could be wrong. Response.Redirect is something you do server side. If you want to redirect to another page from your client-side HTML links, you can easily do so with basic javascript like this:

Copy & Paste this into a new HTML document and open in your browser.
<a href="javascript:Redirect('http://www.google.com')">go</a>
<script language="javascript">
function Redirect(url) {
/* Navigate, and put current page in history. */
window.location = url;
/* Navigate, and replace this page in history. */
//location.replace(url);
}
</script>


If you want to pass querystring parameters, then build your query string in the javascript function using whatever information you need to use. I show passing Google to the function and the function then navigates. Maybe you want to hardcode a url in the function and only pass the querystring parameters. Maybe you don't want to pass anything, and instead, want the function to read your existing form fields to build a querystring.

If you need additional help with this, let us know.
Troy Wolf: site expert
Shiny Solutions


  Re: response.redirect within a heyperlink  Learner at 08:09 on Monday, April 05, 2004
 

Is it possible to pass asp.net variables to this javascript?

  Re: response.redirect within a heyperlink  Troy Wolf at 12:51 on Monday, April 05, 2004
 

Again, I have to say I'm not familiar with ASP.NET, and it is in may way very different from traditional ASP, but....passing variable values from server side code to client side code is as easy as writing them into the javascript just like you response.write anything else. For example:

<%
Dim MyVar
MyVar = "Testing"
%>
<script language=javascript>
var MyVar = "<%= MyVar %>";
alert(MyVar);
</script>
Troy Wolf: site expert
Shiny Solutions


  Re: response.redirect within a heyperlink  zm at 13:50 on Sunday, April 11, 2004
 

Please try this, use "<a>" tag instead of Response.Redirect:

'Code starts here

<a href="/forum/storedtestresult_oLocation__lt_oLocation.SelectedItem.Text_gt__ampoSkill__lt_oSkill.SelectedItem.Text_gt__ampoJobType__lt_JobType.SelectedItem.Text_gt_.html">Go</a>

'Code ends here

Now, just replace "<a....????????????need help here???>go</a>" by above code.

Hope this will work fine.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: onload event
•  Active Widgets
•  Re: onmouseover change image and text
•  Line Printer Interface
•  import contacts of msn/yahoo
•  Call windows apps from web apps
•  Re: ASP.NET web controls
•  netscape 6 browser problem
•  Re: Print .doc file from the website using System.Diagnostics.Process


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005