0

in asp.net mvc c# crud operation (e.g create, update, remove and detail) i get row by id on update and detail. when i get row by id for update, id show on url. I m creating blog website in asp.net mvc c# blog table has column like blogId, blogTitle, blogDetail etc...

My question is this i want to get row by blogid but show blogTitle on url

3
  • You need to configure routes for your endpoints. Commented Jun 30, 2022 at 8:18
  • Does this answer your question? How to display only name in url instead of id in mvc.net using routing Commented Jun 30, 2022 at 8:20
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jun 30, 2022 at 13:21

1 Answer 1

0

Be sure that your blogTitle is unique or you can create slug from your blog title and you can use that

1# you need to change and fix your route in RouteConfig.cs typically the id parameter needs to be replace with blogTitle

and that's it. it will land you to right blogTitle or slug you have created.

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

id parameter should not be replaced, instead, it needs to be set to optional.

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.