Timeline for ASP.NET Product Listing
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 27, 2016 at 18:45 | comment | added | Stefano d'Antonio | @kai you are right; but it might cause some race conditions in some edge cases and it's good practice anyway. | |
Jun 27, 2016 at 15:06 | comment | added | sara |
Actually, at least if we're talking EF, then Find will cache the entity in-memory if it was found, so calling it twice won't be "expensive". I agree it'd be "better" to bind it to a local variable though.
|
|
Jun 27, 2016 at 13:24 | comment | added | Stefano d'Antonio | Instead of using the ViewBag, you can add the categories to the viewmodel from the controller action and then pass it as model of the partial view; even better, you can invoke another controller action which returns the partial view and sets its content to the categories collection. | |
Jun 27, 2016 at 13:22 | comment | added | Stefano d'Antonio |
@WannaBeGnome if you don't specify a model directive, the model will be considered dynamic on which you don't get IntelliSense and potentially you can use any property getting a runtime error if it doesn't exist. Have a look here: codereview.stackexchange.com/questions/133180/…
|
|
Jun 27, 2016 at 13:15 | comment | added | Marinaro | One more thing. If I saved categories in ViewBag and then use that in the partial view to list categories, would it be appropriate solution? | |
Jun 27, 2016 at 13:05 | comment | added | Marinaro | Thanks for reply. What do you mean by making the view strongly typed? | |
Jun 27, 2016 at 12:25 | history | answered | Stefano d'Antonio | CC BY-SA 3.0 |