model-view-controller

Find ids of checked checkboxes with jQuery in MVC

余生颓废 提交于 2019-12-24 08:58:10
问题 I have a Field model, which represents a certain field (Name, Description, ...) class FieldModel : EntityModel { ... public bool ToCopy { get; private set; } public string Id {get; private set; } ... } An Index model, which has a collection of Fields: class EntityModel { ... } class IndexModel { public IEnumerable<EntityModel> Fields { get; private set; } } Controller for copy, that should accept ids of fields to copy: public void CopyFields(string[] fieldsIds) { ... } And I need to select

MVC Fundamentals: Passing work along to the view?

岁酱吖の 提交于 2019-12-24 08:57:11
问题 I'm using Doctrine2 and CodeIgniter2, and am new to both, as well as to OOP/MVC, so please use simple explanations :) For testing purposes, I have a Controller a Model and a View. I want to display data from a table that contains user information. First name, last name, ID number, and so forth. My controller makes a call to the model- which retrieves data from the doctrine entity, and then the controller passes that data to the view. (controller) class Test_v_to_m extends CI_Controller {

How to POST in ReactJS

廉价感情. 提交于 2019-12-24 07:46:22
问题 I am new to ReactJs. I am working with ASP.net and reactjs to create a crud application. I have displayed the table. Now I am trying to insert values into table from forms. Please let me know how to do the same. I have shared the controller and reactjs code. EmployeeController: [RoutePrefix("api/Employee")] public class EmployeeController : ApiController { EmployeeEntities db = new EmployeeEntities(); [Route("GetEmployeeList")] public IQueryable<EmployeeTable> GetEmployeeList() { return db

One method to handle all the struct types that embed one common struct (json marshalling)

我们两清 提交于 2019-12-24 06:47:13
问题 I have a gin-gonic web app with somewhat MVC architecture. I created a couple of models, all of them embed one common struct: type User struct { ID int Name string } type Admin struct { User Level int } ... { User } Now I want to store them in database in json format. The goal I want to accomplish is to code only one function/method that will marshal any model and will save save it into DB. This method must marshal all the fields of current model, not only from User struct, e.g. User must be

C# Base64 Validation

对着背影说爱祢 提交于 2019-12-24 06:38:06
问题 I am receiving a base64 encoded file in my MVC controller's action from an AJAX request. Now I want to validate the base64 encodedstring. I want to allow only PDF, JPG and PNG formats. How can I validate the base64 encoded string on the server-side, so it will not take any other type of base64 encoded files, e.g. docx , exe etc.? I want to perform server-side validation on that regardless of Javascript validation. As you may know it may be hacked. Below is the base64 encoded version of an exe

In client side MVC, who should handle client-server communication?

雨燕双飞 提交于 2019-12-24 06:14:15
问题 I'm working on a client/server product. Basically, server will transfer a document to client side to do editing. The client side has full MVC architecture. The document is the model. Now the problem are: There are some calculation in the model that need some resources in server. For performance reason, some part of the model should be lazy loaded. One example is the image in a document. It didn't load when opening the document, but there is something that load the image, once it loaded it

Call an Action Method From View

空扰寡人 提交于 2019-12-24 05:07:25
问题 Here is the Action Method [HttpGet] [ViewException] [UserFilter(OpUserAuthType.Admin, OpUserAuthType.Normal)] public ActionResult YorumEkle(string id, string pid) { ..... } It has a view. But from another view, I want that action method to be called by an onclick event or anything to be clicked on. For instance: <a href="" onclick="">Call YorumEkle Method</a> 回答1: Use the ActionLink HtmlHelper like this... @Html.ActionLink("Call YorumEkle Method", "YorumEkle", new {@id = "hello", @pid="yarg!"

Using initialize method in a controller in FXML?

扶醉桌前 提交于 2019-12-24 03:45:35
问题 I have a Java application with a view written in FXML. I am wanting to select a default tab, so when the program launches the first tab is shown as selected. I have seen the best way to do this is create an initialize() method in the controller and annotate it with @FXML which should the be loaded. For some reason though, the method is never executed. Code is below. MainApp.java import controller.Controller; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx

What should I do to speed up a slow GWT app using MVC

僤鯓⒐⒋嵵緔 提交于 2019-12-24 03:40:10
问题 I have changed my app to use MVC and it has gotten pretty slow. Description: The application has a number of 5 composites, each composite represents different data and is not always showing The app is using MVC and I am passing the model to each composite when an update occurs. I am rebuilding a Tree (and all tree items) every time a notify is recieved, however, only one of the tree items would have changed, so this is possibly a waste. Due to the style of the app I have to even notify() for

How to dynamically load partial view Via jquery ajax in Asp.Net MVC

◇◆丶佛笑我妖孽 提交于 2019-12-24 03:27:35
问题 I have page where i need input data and submit form. Page should dynamically load partialView through ajax. What i have: SearchData Model: public class SearchData { public SearchData() { documents = GetDocuments(); data = new List<DisplayData>(); } public bool isAdmin { get; set; } public string emc { get; set; } public string receiver { get; set; } public DateTime receiveDateFrom { get; set; } public DateTime receiveDateTo { get; set; } public int document { get; set; } public List