viewmodel

The value for a object inside a viewmodel lost on redirect to action in asp.net mvc 2.0?

。_饼干妹妹 提交于 2019-12-25 04:39:08
问题 I have a view model - public class MyViewModel { public int id{get;set;}; Public SomeClass obj{get;set;}; } public class SomeClass { public int phone{get;set;}; public int zip{get;set;}; } So on my controller when I post back MyViewModel it has all the values for all the fields...but when I do return RedirectoAction("SomeAction",vm);//where vm->MyViewModel object that has all values... it loses the values for SomeClass object?...can anyone please help me out 回答1: The second argument to

MvvmCross : ViewModel Navigation in code

青春壹個敷衍的年華 提交于 2019-12-25 04:22:49
问题 I got 3 ViewModels. FirstViewModel, SecondViewModel and ThirdViewModel. I want to click a button in FirstViewModel, then it will open SecondViewModel. After SecondViewModel is opened, without any user interaction, ThirdViewModel will be opened by code. I couldn't get the ThirdViewModel to open automatically. using Cirrious.MvvmCross.ViewModels; namespace PortableClassLibrary1.ViewModels { public class FirstViewModel : MvxViewModel { private string _hello = "Hello MvvmCross 1"; public string

Windows Phone 7 - TextBlock Text binding to ViewModel not returning anythinig

对着背影说爱祢 提交于 2019-12-25 03:32:55
问题 I have built a view model and the listbox binds to the ObervableCollection, but a textbox I am using for a temp url wont bind and return data. I am not getting any errors either on compile or run ViewModel: public class HomepageModel:INotifyPropertyChanged { public TextBlock bgrImg{get;set;} public ObservableCollection<MenuItem> menu {get; private set;} public HomepageModel() { this.menu = new ObservableCollection<MenuItem>(); } public void Load() { bgrImg = new TextBlock(); bgrImg.Text = "

ASP.Net MVC2 - Set ViewModel values with retrieved from db object's values with DataAnnotations

一世执手 提交于 2019-12-25 03:27:54
问题 Prior to using a ViewModel, I could easily pass the "soon to be edited" object directly to the view without needing to fuss over setting individual properties etc as the View conveniently accepted the Employee type directly.. [HttpGet] public ActionResult EditEmployee(int? id) { EmployeeRepository ER = new EmployeeRepository(); Employee SomeEmployee = ER.GetEmployee(id.Value); if(SomeEmployee!=null) return View(SomeEmployee); But now I'm using a ViewModel with DataAnnotations attributes

Can you help with this MVC ViewModel issue?

断了今生、忘了曾经 提交于 2019-12-25 02:47:37
问题 I have a problem with an MVC view that I just cannot seem to solve. Here it is. 1) I have an index view that displays a list of retailers with data from the retailers table. So far so good. 2) I also want to include the retailer categories for each retailer which are stored in a RetailersCategories table where each retailer can have multiple categories I have tried a few things but cannot seem to make this work. The closest I came to what I wanted was using a view model. I have included the

ASP.NET with Knockout variable length list with combobox - how to bind?

廉价感情. 提交于 2019-12-25 01:56:14
问题 With the following ASP.NET models public class User { public string Name { get; set; } public LEmail LEmail { get; set; } } public class LEmail { public IList<CLabel> Labels; public IList<CEmail> Emails; } public class CLabels { public IList<CLabel> Labels { get; set; } } public class CLabel { public string Name { get; set; } } public abstract class CEmail { public string SelectedLabel { get; set; } public string Name { get; set; } } Filling it out with dummy data and sending to appropriate

Inefficient MVC ViewModel Making Multiple Calls to the Database?

ⅰ亾dé卋堺 提交于 2019-12-25 01:49:28
问题 I clearly don't know what I'm doing. This MVC stuff is really blowing my mind in trying to keep with the pattern. I've been following the MVC tutorials as well as mega-googling and this is the corner I've painted myself into. I have multiple similar pieces of data I'm trying to get to a view. I'm able to get my code to work, but to me it just looks like it's going to be highly inefficient as we start pulling large recordsets from the db due to multiple calls to the db. So, I have a

Adding data to an existing model with real data to MVC

泪湿孤枕 提交于 2019-12-25 01:14:30
问题 I have a previous question that shows how my models look and it was adding FAKE data. Add to Existing Model based on a POCO with need to add to List<T> Now I am wanting to add REAL data and i'm wondering how to do this. Should or need I loop over the result ?? public IActionResult FindPerson (FindPersonViewModel findPersonViewModel) { var firstName = findPersonViewModel.FirstName; var middleName = findPersonViewModel.MiddleName; var lastName = findPersonViewModel.LastName; var emailAddress =

Will the `onChanged` method trigger just as we change the data? Even if we dont change the state of activity?

半腔热情 提交于 2019-12-25 00:54:41
问题 Will the onChanged method be called if we dont change the state of the activity or restart the activity? ( Even if the data changes ) . If it doesnt happen how shall i make it happen ? onCreate() { viewModel.getHolidaysDatesFromServer(..).observe(.....this,new Observer<GetHolidaysDatesFromServer>) { onChanged(GetHolidaysDatesFromServer GetHolidaysDatesFromServer) } } and my ViewModel class ... public class CalendarLifeCycleOwner extends AndroidViewModel { Context context; MutableLiveData

ExtJS chained store filter not filtering

依然范特西╮ 提交于 2019-12-24 18:18:37
问题 Filter for combobox is not working and I am not sure why. I have two comboboxes, one is province and other is city . When I select a province, the city combobox will be filtered according to the selected province using the province_id. View Model Code: data: { selectedProvince: null }, stores: { province: { fields: [ 'province_id', 'province_name' ], proxy: { type: 'ajax', url: '*some url to province*', reader: { type: 'json', rootProperty: 'data' } } }, city: { fields: [ 'city_id', 'city