Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009
    Location
    Atlantis
    Posts
    167

    Finish User Admin not deleting user

    Im just wrapping up on this video and when I click on the delete user button, the confirmation dialoge box pops up but the user is not being deleted, I've placed a breakpoint as Nelson does on the Delete user method inside UserController.cs but this method is never called when I click the confirm message. when I use internt explorer I get the error message

    "0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'appenedTo'

    I've tried both with Jquery2.1.1 and Jquery2.1.0 and get the same result.



    Forms.js

    Code:
    $(document).ready(function(){
    
    
        $("a.post").click(function(e){
    
    
            e.preventDefault();
    
    
    var $this = $(this);
    
    
    var message = $this.data("message");
    
    
    if(message &&!confirm(message))
    
    
    return;
    
    
            $("<form>")
    
    
    .attr("method","post")
    
    
    .attr("action", $this.attr("href"))
    
    
    .appendTo(document.body)
    
    
    .submit();
    
    
    });
    
    
    
    });
    
    
    BundleConfig.cs

    Code:
    var backendScripts =newScriptBundle("~/js/backend");
    
    
                backendScripts.Include("~/scripts/jquery-2.1.1.js", "~/scripts/forms.js");
    
    
                backendScripts.Transforms.Add(newJsMinify());
    
    
                bundles.Add(backendScripts);
    Delete method
    Code:
    [HttpPost]
    
    
    publicActionResult Delete(int id)
    
    
    
    
    
    
    
    
            {
    
    
    
    
    
    
    var user = _database.Users.Find(id);
    
    
    if (user ==null)
    
    
    return RedirectToAction("index");
    
    
                _database.Users.Remove(user);
    
    
                _database.SaveChanges();
    
    
    return RedirectToAction("index"
    
    
    
    
    
            }
    
    
    
    Last edited by GreyWalker; 10-09-2014 at 04:37 PM.

  2. #2
    Join Date
    Dec 2009
    Location
    Atlantis
    Posts
    167
    So I'm still trying to wrap my head round this error, and I've noticed something curious, when I receive the error in Visual Studio the error is this.
    Click image for larger version. 

Name:	Error.png 
Views:	94 
Size:	33.8 KB 
ID:	74323

    However my Forms.js looks like this.

    Click image for larger version. 

Name:	Code.png 
Views:	96 
Size:	23.2 KB 
ID:	74322

    Notice how the line of code ".appendTo(document.body)" is spelled between to the two photos, no matter what I do when I run the application a forms.js[Dynamic] is displayed with that line of code changed to ".appenedTo(document.body)" I am utterly confused by this. Anyone any ideas what’s causing this?
    Last edited by GreyWalker; 10-09-2014 at 05:41 PM.

  3. #3
    Join Date
    Mar 2016
    Posts
    7
    do this working fine now ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •