0

I have the following code to display query string in my view I used ViewContext.RouteData.Values but it only display id how can i display the rest query, my url looks like this http://localhost:XXXX/Products/Product/Edit/4437?ProductName=ASSY 670975 6X5

I have used the following code to get data from url

var ProductID = ViewContext.RouteData.Values["id"];
var ProductName= ViewContext.RouteData.Values["ProductName"];

I'm able to display 4437 or the ProductID value, How can i display ProductName or ASSY 670975 6X5 in a view?

1 Answer 1

0

Try this

var ProductName = Request.QueryString["ProductName"]
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you! but i get The name Request doesnt exist in the curent context, I also tried HttpContext.Current.Request.QueryString["ProductName"]` same message on `HttpContext doesn't exist
Thank you~ this worked for me @Context.Request.Query["ProductName"]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.