1

Need advice on below scenario.

I have two links on my page

1.) Read only Mode

2.) Normal Mode

Both the link will displays same view, but for link one my view will be rendered in read-only mode.

Question

I have two ways to do this.

 1. Create two different actions in my controller.
    1.) Read only Mode--- My link will be---- Controller/IndexRO
    2.) Normal Mode----- Controller/Index --- ("Index and IndexRO")

 2. Pass a query string parameter
    1.) Read only Mode--- My link will be---- Controller/Index?mode=ReadOnly
    2.) Normal Mode----- Controller/Index?mode=Normal

I want to understand pros and cons of both the ways. Just want to understand which one will be easier going further and which can create problems.

Its an MVC4 asp.net 4.0 web application.

1 Answer 1

1

I would definitely go with the second way. You generally do not want to create the same object twice. It's not professional and lowers the readability of your code. Passing a parameter through url would be better

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

Comments

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.