|
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)
|
|
|
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.
|
|
|
|
|
Is it possible to pass asp.net variables to this javascript?
|
|
|
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> |
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|