Solved

goto aspx page based on id value

Posted on 2010-08-24
6
434 Views
Last Modified: 2012-05-10
I have an asp.net 2.0 FormView that displays customer data as summary.
I need to navigate to the customer details page, based on click event on customer_id field.
The problem is that I dont know how to configure the destination page to display proper data based on customer_id parameter (somethiing like: customer_id=1234, redirect to DateClient.aspx?id=1234)
Some code attached. Thanks

<asp:HyperLink runat="server" NavigateUrl='<%# Eval("Customer_Id", "~/DateClient.aspx?ID={0}")  %>'>
<%# Eval("Customer_Id")%>
</asp:HyperLink>

Open in new window

<asp:HyperLink runat="server" NavigateUrl='<%# Eval("Customer_Id", "~/DateClient.aspx?ID={0}")  %>'>

<%# Eval("Customer_Id")%>

</asp:HyperLink>

Open in new window

0
Comment
Question by:danielivanov2
  • 3
  • 2
6 Comments
 
LVL 4

Assisted Solution

by:udaydidigam
udaydidigam earned 125 total points
ID: 33510429
in onload
Response.Redirect("your_url.aspx?your_url_variable=" + @variable_from_form);
http://www.xcess.info/request_url_parameters_details_asp_net_aen.aspx 
0
 
LVL 35

Expert Comment

by:YZlat
ID: 33510537
in order to retrieve the ID on DateClient.aspx page, use  Page.Request.QueryString["ID"] or Page.Request.QueryString[0]
0
 
LVL 35

Accepted Solution

by:
YZlat earned 125 total points
ID: 33510563
if you are using C#, try

int ID = Convert.ToInt32(Page.Request.QueryString["ID"]);

or

int ID = Convert.ToInt32(Page.Request.QueryString[0]);

or if you are using VB.NET, try

Dim ID as Integer = CInt(Page.Request.QueryString("ID");

or
Dim ID as Integer = CInt(Page.Request.QueryString(0);

Then you can just use ID variable in your code
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:danielivanov2
ID: 33510909
I have tried to use Response.Redirect,  using a session variable as response variable,
Response.Redirect("DateClient.aspx?Id=" + Session["SelectedCustomersList"].ToString());

but browser response is:
"The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
URL="http://localhost:3474/Pricing%20Tool%20version6/App_Pages/DateClient.aspx?Id=1,10018000"

is comma "guilt" of that? should I replace comma with some other character (#,-)?
0
 
LVL 35

Expert Comment

by:YZlat
ID: 33511475
Do you really need ResponseRedirect? Specifying NavigateUrl in your Hyperlink should be enough, shouldn't it?
0
 

Author Comment

by:danielivanov2
ID: 33511563
Yes, I dont need specifically the ResponseRedirect, but in this case, when the user clicks the link, i want to set the session variable with the formview value and thereafter to call a method (found in a third page) that populate a gridview (that is located within the masterpage)

to be more clear:

the dateclient.aspx would be accessed either:
1. search page->add selected customers (1 or many) to selectiongridview and thereafter displaying the dateclient.aspx page by oressing a button, or
2. search pricing case->display customer details in a formview - when presssing customerid link, selectiongridview  will be filled with details and user is redirected to dateclient.aspx page.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now