Click here to Skip to main content
13,196,426 members (49,514 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have a 2 different url's,
based on selection i want to navigate into another page.
How to do this can any body help me about this...
Posted 12-Feb-13 0:02am
Irbaz Haider Hashmi 12-Feb-13 6:04am
yes but you have to be more descriptive for this to get help.
Do you have dropdown, checkbox, radio button. how selection is performed.
naveensenagasetti 12-Feb-13 6:05am
for based up on parent project code
Irbaz Haider Hashmi 12-Feb-13 6:08am
What have you done so far?
naveensenagasetti 12-Feb-13 6:12am
<asp:HyperLink ID="link" runat="server" Text="EXCEL MANUAL" OnClick="btnManual_Click" >

protected void btnManual_Click(object sender, EventArgs e)

if (COM_Code == 5)
link.NavigateUrl = "http://eipvidhyadev/edrc/elect/O11153/Documents/EMS_PTD.xls";
else if (COM_Code == 1)
link.NavigateUrl = "http://eipvidhyadev/edrc/ems/O10070/Documents/EMS_BnF.xls";
Ankur\m/ 12-Feb-13 6:09am
Client side or server side?
Google for 'Response.Redirect' and 'Server.Transfer' methods for server side redirects. And 'window.location javascript' for client side redirects.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

naveensenagasetti 12-Feb-13 6:21am
I'm also tried using Response.Redirect & server.Transfer but my boss is not accepted to use those , he ask me using only hypelinks
Irbaz Haider Hashmi 12-Feb-13 6:51am
I am not sure why your boss does not allow this but if you want to do it using javascript

ScriptManager.RegisterClientScriptBlock(this, GetType(), "Redirect", "window.location.href = ''", true);
Irbaz Haider Hashmi 12-Feb-13 6:48am
You can set the navigation url but to invoke these you need to invoke their onclick function.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

add an attribute Target="_blank" to your 'link ' control.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

There are many ways to do the same. The main problem is, you'll never take the help of Google. Try any one of the following:
$(function() {
  $('#<%= button1.ClientID %>').click(function() { 
      window.location.href = "Webform2.aspx"; 

<asp:button id="button1" runat="server" xmlns:asp="#unknown" />

Or, for a specifically ASP.NETesque way to do it, you can use Button.PostBackUrl = "Default2.aspx";
<input type="submit" name="button1" value="Button" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("button1", "", true, "", "webform2.aspx", false, false))" id="button1" />

Sever Side
If you've got other processing to do server-side and you need to redirect afterwards, use Response.Redirect("Default2.aspx"); or Server.Transfer("Default2.aspx"); in your click event of button/object.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171019.1 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100