New answers tagged

2

As talking about content-type headers only makes sense in the context of a remotely rendered view, as it typical for web-applications, I will assume that is the case here as well. The content-type header, as well as other headers, are part of the communication mechanism for transferring the View information from the back-end part to the front-end (view ...


2

It all depends on how you configure your server. The slightest mistake could give anyone the ability to read files as text. Resources and .cs files included. Storing users' passwords plain text is always a bad idea. You should use existing algorithms which would create, for a given password, a salted hash. If an intruder gets (read-only) access to all your ...


0

Following SOLID principles will solve any kind of problems like these. If you want to your classes to have JUST A SINGLE responsibility, you should define separate DataSource and Delegate classes and simply inject them to the tableView owner (could be UITableViewController or UIViewController or anything else). This is how you overcome separation of ...


0

Here's my current method for accomplishing what you're after. I like this in that there's JUST ONE controller method "per page". // Here's the ViewModel, you can add validation via IValidatableObject if you like public class CreateWidgetViewModel { public int SelectedDangleId { get; set; } // to be collected from user input via DropDownList [...


1

Because the view model is recreated with each request, it can be a good idea to separate the "thing" that creates the options for your drop downs from your view models. It has the added benefit of making it even easier to added auto fill drop downs later, where you have a controller action that simply returns new options for the drop down in JSON format. I ...


1

If the page is posted, and there's an error like they forgot to put a User Name in, we redirect them to the page again to try again, at which point we also have to remember to repopulate the model's List before redirecting them back to the page. As you mention, main problem is recalculating or refilling something in post method. Also, you already fill data ...


2

I think this is the main difference between MVC and MVVM approaches. In MVC you have the controller populates the ViewModel which is essentially just the a struct of the various data the view needs In MVVM you don't have a controller, so all the logic goes in the ViewModel, which is now a 'proper' class with methods and everything. If you are in the ASP ...


Top 50 recent answers are included