patterncsharpMinor
Redirecting a user
Viewed 0 times
userredirectingstackoverflow
Problem
When the user clicks the first button ('Back to List' button), I redirect the user to the Employee List page. Can you please review this and suggest if there is any better way of achieving the same?
I am concerned about the first button, however if you have feedback for any other code as well, please mention that.
@using (@Html.BeginForm("Edit", "Employee", FormMethod.Post, new { id = "editEmployeeForm" }))
{
@Html.LabelFor(emp => emp.FirstName)
@Html.TextBoxFor(emp => emp.FirstName)
@Html.LabelFor(emp => emp.LastName)
@Html.TextBoxFor(emp => emp.LastName)
Back to List
Update
}I am concerned about the first button, however if you have feedback for any other code as well, please mention that.
Solution
Semantically, HTML button tags are supposed to represent a user's action, whereas the link tags are supposed to take care of the navigation between pages.
That said, as @user1320170 pointed out in comments, your tag should be a link ( tag.)
You'll notice it's much clearer this way.
Apart from that, your code is good, using
That said, as @user1320170 pointed out in comments, your tag should be a link ( tag.)
You'll notice it's much clearer this way.
Apart from that, your code is good, using
@Url.Action("Index", "Employee") is a good plan.Context
StackExchange Code Review Q#97452, answer score: 5
Revisions (0)
No revisions yet.