Saturday, 15 January 2011

asp.net - TryUpdateModel does not update anything for FormView -


I am using Framework 4.5 and have decided to take advantage of its improvements. Suppose I have the following control within the FarmVisse:

  & lt; ASP: text box id = "eventnumbertaxbox" run = "server" text = '& lt;% # items Avent_num% & gt; ' / & Gt;   

In my update, I do the following:

  Public void UpdateModelFromView (int? Id) {var modelView = New Alert Message Controller (). LoadById (ID); Var updateSuccess = TryUpdateModel (modelView); If (updateSuccess) {New AlertMessageController () Save (modelView); RedirectToViewPage (); }}   

The problem is that although all the changes made by me in the form collection are included - in the given case, I have set Event_Num as some value - reflected on the Model ModelView Does not happen. In other words, I make any changes in the FormView control, which are ignored and saved as the model is loaded ...

< The item is the only data binding for div class = "post-text" itemprop = "text">

You must use Bindium, i.e., BindItem.Event_Num for two-way data binding.

No comments:

Post a Comment