Questions tagged [updatemodel]
217 questions
5
votes
1 answer
Mocking Requirements for TryUpdateModel in ASP.Net RC1
I am in the process of writing some unit tests for my controllers in RC1. Here is the
controller's public signature I'm testing:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult AcceptColleague()
{
The implementation inside the…

Cole B
- 75
- 6
5
votes
3 answers
asp.NET MVC 2 DataAnnotations UpdateModel validation
I'm trying to use DataAnnotations to add validation to my models in asp.NET MVC 2 RC2, using TryUpdateModel
var user = UserManager.Find(id);
this.TryUpdateModel(user, form.ToValueProvider());
This updates the…

Christian Droulers
- 853
- 1
- 8
- 21
5
votes
5 answers
ASP.NET MVC UpdateModel vulnerable to hacking?
I have an ASP.NET MVC application that is calendar-like. As per the NerdDinner example, I'm updating the results of my edit page using UpdateMethod()
In my app, certain events are fully customizable and certain ones are only partially customizable.…

Dinah
- 52,922
- 30
- 133
- 149
4
votes
1 answer
MVC UpdateModel ComplexType
If you have the following type.
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public List Parameters { get; set; }
public Address Address { get; set; }
}
public class…
Bamelis Steve
4
votes
3 answers
MVC UpdateModel and Sub Classes vs Base Class
I'm looking to use the UpdateModel method to a Sub Class that retrieved at runtime, would be great if someone could shed the light on whether I'm making a total hash of it and/or whether or not what I'm trying to do is possible.
I'm using a generic…

Tr1stan
- 2,755
- 1
- 26
- 45
4
votes
1 answer
ASP.NET MVC auto-binds a refreshed model when ModelState is invalid on HttpPost
I'm working on an ASP.NET MVC2 app. I've come to realize a very surprising, yet amazing thing that MVC does behind the scenes having to do with the ModelState and model binding. I have a ViewModel which has a whole bunch of data - some fields being…

tbehunin
- 1,043
- 1
- 12
- 24
4
votes
4 answers
Django Updating Existing Model field
I have a model in Django with a foreign key to Django User Model. I am trying to update my model with a form, but database isn't updating. I can't figure out the problem.
model.py
from django.conf import settings
class UserInfo(models.Model):
…

Enam
- 95
- 1
- 1
- 9
4
votes
2 answers
NodeJS & Mongoose: Add element to existing empty array
I am building a NodeJS application for creating reports based on data from a MSQL database. All application relevant data is stored in a MongoDB using Mongoose. My mongoose model contains an empty array which is then filled by the user via a…

dj2bee
- 146
- 9
4
votes
3 answers
ASP.NET MVC 2 RC model binding with NHibernate and dropdown lists
I have problem with model binding in my ASP.NET MVC 2 RC application that uses NHibernate for data access. We are trying to build the application in a Ruby on Rails way and have a very simple architecture where the domain entities are used all the…

HakonB
- 6,977
- 1
- 26
- 27
4
votes
1 answer
In ASP.NET MVC, is UpdateModel recommended
In ASP.NET MVC, UpdateModel is dreadfully convenient if not a bit too black box. One of the primary reasons I use ASP.NET MVC, however, is exactly for the insane amount of control I get compared to ASP.NET so from an ideology perspective, the black…

Dinah
- 52,922
- 30
- 133
- 149
4
votes
2 answers
Models not being saved in Play Framework
Assume a model named User:
@Entity
public class User extends Model {
@Id
@Constraints.Min(10)
public Long id;
@Constraints.Required
public String username;
@Constraints.Required
public String password;
public…

Trolley Man
- 43
- 3
3
votes
1 answer
MVC 3 Master / Detail UpdateModel inserts new detail records instead of updating existing records
Ok, I've read Phil Haack's article on binding to a list and I've got that working fine on one view. But what I'm stuck when doing it off a master record.
I've got a really simple form for this object
public class Master
{
public int ID { get;…

DanielEli
- 3,393
- 5
- 29
- 36
3
votes
2 answers
Which event should be used to update a Model from TextBox (LostFocus, LostKeyboardFocus, etc) in WPF? How to set precedence of events in WPF?
I have an application in which there are lot of TextBoxes and some Buttons like Save, SaveAs,etc.
When the user edits a TextBox, I have to check the DataBase for some range, validate the range and update the DataBase.
If there is any error in…

Gurucharan Balakuntla Maheshku
- 2,399
- 9
- 43
- 76
3
votes
1 answer
Update user on the same page laravel 5
I am new to the framework and I have a question.
I made a login authentication to access and when I go to my profile page I can view my data and change all on the same page.
I need to go get my ID to be able to do the update or not needed?
What do I…

Jose Cerejo
- 231
- 1
- 5
- 19
3
votes
1 answer
CakePHP custom Validation rule checks unique field combination only on create
I have a Database with a User model. These Users should be unique by their name and birthday.
So I wrote a custom validation function called checkUnique
public function checkUnique($check){
$condition = array(
"User.name" =>…

SPie
- 174
- 2
- 13