Reputation: 683
Lets say i have a startpage home.aspx with 3 links to different carbrands like
BMW VW Volvo
I set a querystring to add id for the brand like brands.aspx?id=1 for BMW 2 for VW and 3 for Volvo.
This way i can use the same code for all 3 brands but the Content will Change depending on id. In the brands page i Show the different models from the cars. Like BMW m3, BMW 325 and so on...
Now to my Problem, i want to be able to click on for example BMW m3 and get even deeper and go to all different styles from that Special model. For example BMW m3 Turbo black, BMW m3 red...
How can get the value of the id on the page i visit and send it as a Parameter on the new links? I dont want to write the code in code behind.
It should be like this models.aspx?id=@id&model=1020
Hope you understand what im looking for
Upvotes: 1
Views: 15022
Reputation: 14253
To get id use :
var id=Request.QueryString["id"];
then
myLink.HRef="models.aspx?id="+id+"&model=1020";
remember that your link should have runat="server"
in its definition.
Upvotes: 2
Reputation: 14253
If you don't want to use code behind,so use this in your aspx file:
<a href="models.aspx?id=<%=Request.QueryString["id"] %>&model=1020">link</a>
Upvotes: 3
Reputation: 4638
Response.Redirect("Default.aspx?id="+id.Text+"&model="+model.Text+"&modelname="+modelname.Text");
Upvotes: 0