Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Problem with Editing Data using Modal and partialview

$
0
0

Hi everyone I write a simple application and now i want to rewrite my CRUD operations using Jquery/ajax and bootstrap modal forms. Im totally new in jquery and have some problem with editing data. I call Get action and it find and return data but i know how to fill in partial view data fields in Partial View whit this result. Can anyone help?

Index page Edit script:

 function Edit(Id) {
            if (confirm("Are you really want to change this record?"))
            {$.ajax({
                    type : 'Get' ,
                    url : '@Url.Action("AddOrEditPartial","ProductCategory")/' + Id ,
                    datatype: 'json',
                    success: function (response) {
                        ?????
                    }
                });
            }
        }

Controller

[HttpGet]publicActionResultAddOrEditPartial(stringId){ProductCategory data =newProductCategory();
            data = context.Find(Id);returnActionResult(data);}[HttpPost]publicActionResultAddOrEditPartial(ProductCategory pr){bool status =false;if(ModelState.IsValid){var data = context.Find(pr.Id);if(data !=null){
                    data.Category= pr.Category;
                    context.Commit();}else{
                    context.Insert(pr);
                    context.Commit();}returnRedirectToAction("Index");}returnnewJsonResult{Data=new{ status = status }};}

</div>


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>