An example tutorial for sending and binding data in ASP.

Source: Internet
Author: User
This article mainly introduces the application of jquery and Angularjs to data binding in ASP.

The requirement is this, in a list page, the user clicks on the Detailed ammonium button, with the recorded primary key value to another page.
On another external page, get the record data, and then display this record data on the Web page.

First, use the dynamic diagram to demonstrate:

The above is just passing in a value in Ng-click, but in ASP. NET MVC you also need to pass this value to another view. asp. NET MVC pass parameters (model)

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 receive parameter in the controller of the ASP. NET MVC gets the data for 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, give the view a model. Here is the focus of this article, how to pass the model of ASP. Angularjs Ng-model:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.