Click here to Skip to main content
15,850,103 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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...
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.
Naveen.Sanagasetti 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?
Naveen.Sanagasetti 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.

Share this answer
Naveen.Sanagasetti 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.
add an attribute Target="_blank" to your 'link ' control.
Share this answer
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.

Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900