Click here to Skip to main content
11,496,146 members (566 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
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 2:38am
Edited 14-May-12 3:01am
Prasanna Kumari at 14-May-12 7:39am
if any one knows please give me idea......
Sandeep Mewara at 14-May-12 8:02am
What issue you are facing here? You get any error?
Prasanna Kumari at 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
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 14 May 2012
Copyright © CodeProject, 1999-2015
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