Click here to Skip to main content
12,550,111 members (45,323 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET MySQL
This is my view file when i click update it has to be updated in database
myForm.attachEvent("onButtonClick", function (name, command) {
            if (name == "Update" && command == "Update") {     
                    url: '/Home/Update',
                    data: JSON.stringify({
                        Name: myForm.getItemValue("Name"),
                        Duration: myForm.getItemValue("Duration"),
                        Year: myForm.getItemValue("Year"),
                        Comments: myForm.getItemValue("Comments")
                    cache: false,
                    dataType: "json",
                    success: function (str) {
                    type: 'POST',
                    contentType: 'application/json; charset=utf-8'
In controller i define function for update
public JsonResult Update(int Id,string Name,int Duration,int Year,string Comments)
            Training d = new Training();
            if (d.Id == Id)
                d.Name = Name;
                d.Duration = Duration;
                d.Year = Year;
                d.Comments = Comments;
                var str = new { st = "successfully updated" };
                return Json(str, JsonRequestBehavior.AllowGet);
Posted 14-May-12 1:38am
Updated 14-May-12 2:01am
Prasanna Kumari 14-May-12 7:39am
if any one knows please give me idea......
Sandeep Mewara 14-May-12 8:02am
What issue you are facing here? You get any error?
Prasanna Kumari 14-May-12 8:07am
iam not getting any error just update function is not working

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 14 May 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100