Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0
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 1:02am
N@veen.S1.6K
Comments
Irbaz Haider Hashmi at 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 at 12-Feb-13 6:05am
   
for based up on parent project code
Irbaz Haider Hashmi at 12-Feb-13 6:08am
   
What have you done so far?
naveensenagasetti at 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/ at 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
good
Please Sign up or sign in to vote.

Solution 1

Response.Redirect("URL");
Server.Transfer("URL");
  Permalink  
Comments
naveensenagasetti at 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 at 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 = 'http://www.codeproject.com'", true);
Irbaz Haider Hashmi at 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
good
Please Sign up or sign in to vote.

Solution 2

add an attribute Target="_blank" to your 'link ' control.
  Permalink  
Rate this: bad
good
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:
jQuery
$(function() {
  $('#<%= button1.ClientID %>').click(function() { 
      window.location.href = "Webform2.aspx"; 
      });
});
ASP.NET
<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";
HTML
<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.
 

--Amit
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 365
1 Sergey Alexandrovich Kryukov 319
2 CPallini 275
3 DamithSL 214
4 Maciej Los 185
0 OriginalGriff 5,455
1 DamithSL 4,457
2 Maciej Los 3,885
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,115


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2014
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