model-view-controller

Jquery Datatable data to mvc controller

佐手、 提交于 2021-02-20 04:34:25
问题 Hi im having some troubles trying to send my Datatable Data to my controller using ajax. I have a datatable like this : <table class=" w-100 mr-3 ml-3" id="mytable"> <thead> <tr> <th class="text-left">Code</th> <th class="text-left">Date</th> <th class="text-left">Colocacion</th> <th class="text-left">Amount</th> <th class="text-left">Bank</th> <th class="text-left">Company</th> </tr> </thead> <tbody> @foreach (var obj in Model.List) { <tr> <td class="text-left">@obj.Code</td> <td class="text

RoR Filter Out Current User with Join, Select and Order

て烟熏妆下的殇ゞ 提交于 2021-02-19 07:31:10
问题 I have the following statement in an RoR controller called nominations: @users = User.joins(:department).select("CONCAT(last_name, ', ', first_name, ' - ', name) as user_dept, last_name, first_name, name, users.id").order("last_name, first_name, middle_name") In the view, I have this to put this in a drop down: <%= select_tag "nomination[user_id]", options_from_collection_for_select(@users, :id, :user_dept), prompt: "Select User" %> I want to filter out the current user so that someone can't

what is the difference between event binding and property binding?

烈酒焚心 提交于 2021-02-17 21:54:12
问题 In the architecture of angular 2 there are two terms Event binding and Property binding. What is the difference between them? 回答1: Property binding - In case you have to pass the value from parent component to child component (whether the value is static or dynamic) we have to use the property binding that mean by doing so we send the value using attribute on component and receive it in the child component by using @Input decorator for example of property binding see here - <my-child [myProp]

what is the difference between event binding and property binding?

狂风中的少年 提交于 2021-02-17 21:53:45
问题 In the architecture of angular 2 there are two terms Event binding and Property binding. What is the difference between them? 回答1: Property binding - In case you have to pass the value from parent component to child component (whether the value is static or dynamic) we have to use the property binding that mean by doing so we send the value using attribute on component and receive it in the child component by using @Input decorator for example of property binding see here - <my-child [myProp]

How to dynamically add to list with ViewModel in ASP.NET Core 3.1 MVC with JavaScript and C#

喜夏-厌秋 提交于 2021-02-11 17:10:16
问题 I am trying to dynamically add to a list property in my ViewModel using JavaScript. Whenever I submit my form, there are no items in the list in the post controller. I have tried to add to the list inside the JavaScript function using razor syntax like so: @{ Model.Contacts.Add(new Contact { ID = 1, FirstName = "Tester" }) } Just to see if I could even get a item in the list. I've also done it at the top of the page to see if it was just because it was in JavaScript. However when I submitted

How to dynamically add to list with ViewModel in ASP.NET Core 3.1 MVC with JavaScript and C#

十年热恋 提交于 2021-02-11 17:08:58
问题 I am trying to dynamically add to a list property in my ViewModel using JavaScript. Whenever I submit my form, there are no items in the list in the post controller. I have tried to add to the list inside the JavaScript function using razor syntax like so: @{ Model.Contacts.Add(new Contact { ID = 1, FirstName = "Tester" }) } Just to see if I could even get a item in the list. I've also done it at the top of the page to see if it was just because it was in JavaScript. However when I submitted

How to dynamically add to list with ViewModel in ASP.NET Core 3.1 MVC with JavaScript and C#

不问归期 提交于 2021-02-11 17:04:20
问题 I am trying to dynamically add to a list property in my ViewModel using JavaScript. Whenever I submit my form, there are no items in the list in the post controller. I have tried to add to the list inside the JavaScript function using razor syntax like so: @{ Model.Contacts.Add(new Contact { ID = 1, FirstName = "Tester" }) } Just to see if I could even get a item in the list. I've also done it at the top of the page to see if it was just because it was in JavaScript. However when I submitted

MVC Core 3 FromSqlRaw parameters not working as expected

好久不见. 提交于 2021-02-11 15:38:38
问题 Has anyone else run into the issue of FromSqlRaw parameters not working as expected? There is a Gotcha to be aware of. With the latest MVC Core 3 DbContext I added a stored procedure but could not get the FromSqlRaw call to correctly evaluate parameters. SqlParameter[] parameters = { new SqlParameter("DateFrom", dateFrom), new SqlParameter("DateTo", dateTo), new SqlParameter("Sort", sort), new SqlParameter("Aggregation", aggregation) }; return await sp_Visits.FromSqlRaw("EXECUTE dbo.sp_Visits

MVC Core 3 FromSqlRaw parameters not working as expected

眉间皱痕 提交于 2021-02-11 15:36:34
问题 Has anyone else run into the issue of FromSqlRaw parameters not working as expected? There is a Gotcha to be aware of. With the latest MVC Core 3 DbContext I added a stored procedure but could not get the FromSqlRaw call to correctly evaluate parameters. SqlParameter[] parameters = { new SqlParameter("DateFrom", dateFrom), new SqlParameter("DateTo", dateTo), new SqlParameter("Sort", sort), new SqlParameter("Aggregation", aggregation) }; return await sp_Visits.FromSqlRaw("EXECUTE dbo.sp_Visits

Display in view image loaded in controller with yii2

情到浓时终转凉″ 提交于 2021-02-11 15:22:52
问题 I'm trying to display in a view an image loaded in a controller (the image folder is not available directly from the view). I can correctly load the image in the controller but I did not find the correct way in order to provide the view with it. I tried to exploit the Yii::$app->response solution but it seems useful for the download of the image and not for showing it in the view page. Controller code (partial) public function actionView($id) { $imgFullPath = '/app/myfiles/img/65/img.jpg';