Questions tagged [updatemodel]

217 questions
17
votes
2 answers

Is the Rails update_attributes method the best choice for doing an update of a model in the database?

def update @album = Album.find(params[:id]) if @album.update_attributes(params[:album]) redirect_to(:action=>'list') else render(:action=>'edit') end end A Rails 1.1.6 tutorial that I'm covering recommends using the…
17
votes
4 answers

What is correct behaviour of UpdateModel in ASP.NET MVC?

I am interested to know what you guys feel should be deemed "correct behaviour" in terms of the UpdateModel method in ASP.NET MVC. The reason I ask here is perhaps if this functionality is "by design" somebody could clarify as to why it is the way…
GONeale
  • 26,302
  • 21
  • 106
  • 149
16
votes
1 answer

Entity Framework - Update Model From Database... - no update happens!

I have a table in my DB called CompanyDetails. It has a column called CharacterID varchar(255). I just changed it from a NOT NULL column to a NULL column. I ran the 'Update Model From Database...' command in the model browser as well as in the…
Keith Barrows
  • 24,802
  • 26
  • 88
  • 134
16
votes
4 answers

p:selectOneMenu does not set value in bean

Quick question. This hasn't happened to me before when working with SelectOneMenu. This is my code.
Carlos Vergara
  • 3,592
  • 4
  • 31
  • 56
15
votes
3 answers

How to update Model when binding to a ViewModel?

I have an [HttpPost] action method signature like this: [HttpPost] public ActionResult Edit(ExistingPostViewModel model) { // Save the edited Post. } Now, in the past (when i didn't use ViewModels, e.g R&D), i had an implementation of an Edit…
RPM1984
  • 72,246
  • 58
  • 225
  • 350
13
votes
2 answers

ASP.NET MVC 2 problem with UpdateModel

I'm trying to use updatemodel(myItem, formcollection) with asp.net mvc 2 but it fails with the stack trace below. at System.Web.Mvc.FormCollection.GetValue(String name) at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext…
marcus
  • 9,616
  • 9
  • 58
  • 108
11
votes
3 answers

What Does UpdateModel() Do?

In layman's terms, what does UpdateModel() do, as well as TryUpdateModel()? I can't seem to find (on SO or the web) any clear explanation of what it actually does (in clear terms), just people having problems using it. VisualStudio's intellisense is…
SaltProgrammer
  • 1,045
  • 2
  • 13
  • 29
11
votes
2 answers

Update existing database with Entity Framework Code First in MVC

In my MVC application I used Entity Framework 6 and created database with code first approach. After a certain time, I updated one of the entity classes by adding new column and removing some columns. For reflecting these changes to the database I…
Jack
  • 1
  • 21
  • 118
  • 236
10
votes
1 answer

ASP.NET MVC UpdateModel with a sorta complex data entry field

how do i do the following, with an ASP.NET MVC UpdateModel? I'm trying to read in a space delimeted textbox data (exactly like the TAGS textbox in a new StackOverflow question, such as this) into the model. eg.
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
8
votes
3 answers

How do I Unit Test Actions without Mocking that use UpdateModel?

I have been working my way through Scott Guthrie's excellent post on ASP.NET MVC Beta 1. In it he shows the improvements made to the UpdateModel method and how they improve unit testing. I have recreated a similar project however anytime I run a…
8
votes
3 answers

Calling UpdateModel with a collection of complex data types reset all non-bound values?

I'm not sure if this is a bug in the DefaultModelBinder class or what. But UpdateModel usually doesn't change any values of the model except the ones it found a match for. Take a look at the following: [AcceptVerbs(HttpVerbs.Post)] public ViewResult…
Marco M.
  • 2,956
  • 2
  • 29
  • 22
7
votes
2 answers

Linux C - implementing the ability that a program can update itself

I am writing a program in C on Linux environment (Debian-Lenny) and would like the program to be updated when an update is available (the program gets notified when a new update is available). I am looking for a way that the program can update…
Angs
  • 1,605
  • 2
  • 23
  • 47
6
votes
2 answers

asp.net mvc strongly typed view model with multiselect

I would like to know how i can bind my form values to my strongly typed view from a MultiSelect box. Obviously when the form submits the multi-select box will submit a delittemered string of my values selected...what is the best way to convert this…
Paul Hinett
  • 1,951
  • 2
  • 26
  • 40
6
votes
3 answers

ASP.NET MVC: Is UpdateModel an "expensive" operation (due to Reflection)?

I wondered whether UpdateModel is considered an "expensive" operation (due to Reflection lookup of the model properties), especially when seen in the context of a larger web application (think StackOverflow)? I don't want to engage in premature…
Alex
  • 75,813
  • 86
  • 255
  • 348
6
votes
1 answer

Can't seem to get IncludeProperties working on UpdateModel in ASP.NET MVC

Has anybody had luck with this? Please let me know if I understand it correctly, if I have a simple model let's say with: public string Name { get; set; } public string Details { get; set; } public DateTime? Created { get; set; } and then I perform…
GONeale
  • 26,302
  • 21
  • 106
  • 149
1
2 3
14 15