In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to transmit parameters and bind data in ASP.NET MVC. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
The requirement is like this: in a list page, the user clicks the detailed ammonium button, and the primary key value with the record goes to another page.
In another outer page, get the record data, and then display the record data on the web page.
First use the motion diagram to demonstrate:
The above just passes a value in ng-click, but in ASP.NET MVC, you also need to pass this value to "ASP.NET MVC pass parameter (model)" in another view.
Www.cnblogs.com/insus/p/6148167.html
$scope.Detail = function (code) {var objects = {}; objects.Key = code; objects.Value = ""; objects.Controller = "Code"; objects.Action = "ClauseDetail"; $http ({method: 'POST', url:' / Pass/Redirect', dataType: 'json', headers: {' Content-Type': 'application/json Charset=utf-8'}, data: JSON.stringify (objects),}) .then (function success (response) {if (response.data.Success) {_ window.location.href = response.data.RedirectUrl;} else {alert (response.data.ExceptionMessage) }, function error (error) {alert (response.error.data);};}
The Action of the controller in ASP.NET MVC receives parameters to get the data of the database:
Public ActionResult ClauseDetail () {if (TempData ["Pass"] = = null) return RedirectToAction ("Clause", "Code"); var pass = TempData ["Pass"] as Pass; TempData ["Pass"] = pass; Clause c = new Models.Clause (); c.Code = pass.Key.ToString (); ClauseEntity ce = new ClauseEntity (); var model = ce.ClauseByKey (c). FirstOrDefault (); return View (model) }
After fetching the data from the database, the above gives the view a model. Here is the focus of this article, how to pass the model of ASP.NET MVC to angularjs ng-model:
This is the end of the article on "how to transfer parameters and bind data in ASP.NET MVC". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.