model-view-controller

Passing a List/model from a View to a controller

心已入冬 提交于 2019-12-25 07:16:28
问题 I need to pass a model data from a view to a controller. My app works like this: 1. Search for products and return the list of products in a view. 2. Now after user on a product in a list I want to pass that model which contains the list of the products back into a different controller for further processing. As well as the name of the product that the user has clicked on. How can I do this? ViewModel public class ProductViewModel { public ProductViewModel() { products = new List

IBAction in UIView - Compatible with MVC?

两盒软妹~` 提交于 2019-12-25 06:59:14
问题 I'm trying to understand the implementation of the MVC-Pattern in iOS Apps with Objective-C. Right now I have a DataProvider object which holds and provides my data to other objects in my application (Model). Furthermore I have a View (.xib) with an additional class ( UIView ; lets call it "ViewClass"). I told my view to be a subclass of my ViewClass so that I'm able to create IBOutlet s to my subviews like labels and IBAction s to my buttons. So this is obviously my View in the MVC-Pattern.

iOS: Updating text labels with NSUserDefault data on different views

走远了吗. 提交于 2019-12-25 06:19:09
问题 I have a text label on view 1 and a button. If I click the button, I am brought to view 2 through a modal connection. In this view, I enter a number and press a button. The button saves the number to NSUserDefaults, as well as tries to update the text label on view 1 to reflect this number. Button's code: - (IBAction)returnToView1:(UIButton *)sender { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; defaults setObject:@"myNumber" forKey:@"myKey"]; [defaults synchronize];

iOS: Updating text labels with NSUserDefault data on different views

懵懂的女人 提交于 2019-12-25 06:19:06
问题 I have a text label on view 1 and a button. If I click the button, I am brought to view 2 through a modal connection. In this view, I enter a number and press a button. The button saves the number to NSUserDefaults, as well as tries to update the text label on view 1 to reflect this number. Button's code: - (IBAction)returnToView1:(UIButton *)sender { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; defaults setObject:@"myNumber" forKey:@"myKey"]; [defaults synchronize];

Difficulty in editable GtkTreeView

丶灬走出姿态 提交于 2019-12-25 05:51:13
问题 I am writing a piece of software where my user should be able to add data to a table-like editing widget, which I managed to render by using a GtkTreeView . I was able to render my cell editable by setting its editable property via this call g_object_set(content_renderer, "editable", TRUE, NULL); However, my GtkTreeView not only doesn't retain values entered as it's not even showing the data I've added before rendering. I saw a few examples in the web where the developer manually set the user

Ajax Result not Updating Web Grid Automatically MVC 4

匆匆过客 提交于 2019-12-25 05:36:17
问题 View Script function AddToBag() { var url = "/Home/Populate_Entitle/"; $.ajax({ url: url, data: { id: 1 }, cache: false, type: "POST", success: function (data) { alert("hi"); $("#gridContent").html(markup); }, error: function (reponse) { alert("error : " + reponse); } }); } Controller Functions public ActionResult Populate_Entitle(int id) { if (dtEntitle.Columns.Count == 0) { dtEntitle.Columns.Add("sno"); dtEntitle.Columns.Add("Sport"); dtEntitle.Columns.Add("Event"); dtEntitle.Columns.Add(

How to add a class attribute to sitecore MVC image field

南楼画角 提交于 2019-12-25 05:24:35
问题 Using Sitecore mvc field render @Html.Sitecore().Field("FieldName", ContentItem) I would like to add class to image tag like below, <img src="/images/Sample.jpg" class="hidden-xs"> So, How can I add the css class in Site core MVC image field. Thanks in advance. 回答1: You can simply use this one. @Html.Sitecore().Field("FieldName", Model.PageItem, new { @class="large-image", @mw="250" }) 来源: https://stackoverflow.com/questions/36092433/how-to-add-a-class-attribute-to-sitecore-mvc-image-field

deploy website with production configuration automatically in Visual Studio 2010

荒凉一梦 提交于 2019-12-25 05:15:46
问题 I have a question regarding Visual Studio 2010 publish feature which is used after you create a website (MVC framework) to push your dev changes to the live site. I've never worked with MVC until a few weeks ago and I've noticed that before pushing the website code I have to change everywhere where I have localhost in the code and replace it with the domain name I'm pushing to. Then if I want to debug anything on my local machine I have to revert everything back to localhost from domain name.

How do you communicate between presenter and view in MVP scheme?

六眼飞鱼酱① 提交于 2019-12-25 05:12:00
问题 Basically there is two options as I know. The first is view expose notifications events which a presenter should be subscribed to. When user clicks on some button on the view, view just triggers some event, notifies that something is changed. The second is just use an observer pattern and let the presenter interfere some contract. Let it be an interface with methods like events I told you above. An presenter-observer should be attached to the view. As Jeremy Miller in his legendary "Build

How do you communicate between presenter and view in MVP scheme?

眉间皱痕 提交于 2019-12-25 05:11:39
问题 Basically there is two options as I know. The first is view expose notifications events which a presenter should be subscribed to. When user clicks on some button on the view, view just triggers some event, notifies that something is changed. The second is just use an observer pattern and let the presenter interfere some contract. Let it be an interface with methods like events I told you above. An presenter-observer should be attached to the view. As Jeremy Miller in his legendary "Build