Part 16- Delete operation in ASP.NET MVC using JQuery and Bootstrap popup (Modal)

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.พ. 2025

ความคิดเห็น • 84

  • @ArabicSaed
    @ArabicSaed 7 ปีที่แล้ว

    I like your way of teaching .... you are a superman

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Saed Jomaa thanks keep learning and sharing

  • @d.choudhary2705
    @d.choudhary2705 7 ปีที่แล้ว +5

    hi Ashish first of all congratulations to you for nice work. God bless. I request you to please upload more and more videos based on real time project example and try to clear MVC, jquery, LINQ, EF concept. your way of teaching very very good. please carry on. now our aspectation from you more. really appreciate your work.

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว +1

      +Dinesh Kumar thanks Dinesh ..keep learning and sharing

    • @d.choudhary2705
      @d.choudhary2705 7 ปีที่แล้ว +1

      Technotips - Ashish I am waiting your more videos on MVC , jquery. please upload ASAP. I'm saying thanks bottom of my heart. I hope soon you'll upload.

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว +1

      +Dinesh Kumar Sure...

  • @tejaratahan949
    @tejaratahan949 5 ปีที่แล้ว

    Dear Ashish
    Wait you for AspNet Core MVC!
    All things GREATE!!!

  • @kaushikbhadani4227
    @kaushikbhadani4227 7 ปีที่แล้ว

    Very very nice Ashish.!!

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +kaushik bhadani thank you!

  • @kirankumari-nz8lr
    @kirankumari-nz8lr 8 ปีที่แล้ว +1

    Wonderful video and so easy explaination .Thanks for giving such example. previously I was deleting the complete row it was deleted successfully but in my case the table was not having any relationship with other table.Should we need that extra column for handling such issue?

    • @aapkanigam
      @aapkanigam  8 ปีที่แล้ว

      +kiran kumari Your welcome ! Yes we need to add one more extra column .We can delete the table row in case of dependencies. It will give an exception. Keep learning anf sharing ..

  • @vastro7343
    @vastro7343 4 ปีที่แล้ว

    nice work, thanks for sharing, really useful!!!!!

  • @mohamadahmad7600
    @mohamadahmad7600 7 ปีที่แล้ว +1

    hi Ashish congratulations to you for Very Good work. I WISH YOU MAKE more videos based on real time project example and try to clear MVC, jquery, LINQ, EF concept. your way of teaching very very good THANK YOU VERY VERY MUCH

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +asd asdf Thanks asd! If u find this useful then please share this among your friends.

    • @xhonb3436
      @xhonb3436 4 ปีที่แล้ว

      The specified type member 'IsDeleted' is not supported in LINQ to Entities.
      why this problem occurs?
      Thank u if u reply.

  • @FiazAhmad-jd5sq
    @FiazAhmad-jd5sq 7 ปีที่แล้ว

    excelent explanation sir !

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Fiaz Ahmad thanks..keep learning and sharing

  • @aliraza66-h1b
    @aliraza66-h1b 8 ปีที่แล้ว

    great work dear.....

    • @aapkanigam
      @aapkanigam  8 ปีที่แล้ว

      +Ali Raza thanku very much!

  • @navzme
    @navzme 6 ปีที่แล้ว

    Thanks for awesome video

  • @sarangbhople403
    @sarangbhople403 6 ปีที่แล้ว

    Hey Ashish, Nice Video Even helpful to me in My Live Project.

  • @sonthanh2977
    @sonthanh2977 5 ปีที่แล้ว

    i love this tutoria

  • @AlmostDead
    @AlmostDead 5 ปีที่แล้ว

    what is MVCTutorialEntities? can't find where its declared anywhere...

  • @iggzyiggzy
    @iggzyiggzy 6 ปีที่แล้ว

    Hi, great tutorials, thx for all of them :D . Q: Why don't you just pass list to View in Index method ? Like = return View(listEmp)

  • @anshulbansal9059
    @anshulbansal9059 6 ปีที่แล้ว

    Hey Ashish, just want to know one thing. why did you used this "Select(x => new employee { employee_id = x.employee_id, employee_name = x.employee_name, department_id = x.department_id })"? When I was using this then i was getting an exception and when i removed it, program ran. Is there any reason for this?

  • @asifjalal9260
    @asifjalal9260 4 ปีที่แล้ว

    its not work for me. my modal just flashes not stop to get click on yes or no button

  • @Mudassariqbal884
    @Mudassariqbal884 7 ปีที่แล้ว

    Have you given any tutorial of data migration in code first approach?
    actually i doing practice using code first approach so if you didn't give any tutorial please recommend me any tutorial which is best!
    Thanx!

  • @badripn
    @badripn 5 ปีที่แล้ว

    Hi Ashish. The ajax call in the script tag fails and as a result the modal window doesn't closes and the data is not getting removed. Can you pls. suggest. I am a newbie.

  • @ghadeerboland259
    @ghadeerboland259 7 ปีที่แล้ว

    thanks
    your articles very helpfully :)

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Ghadeer Boland thanku

  • @wellington18m
    @wellington18m 4 ปีที่แล้ว

    When I delete the row. It is only gone if a refresh the page. How can I solve this, please help!

  • @haroonniaz7148
    @haroonniaz7148 7 ปีที่แล้ว +1

    Dear sir ,in databse empoyee table you add Isdeleted column which datatype is given to IsDeleted coulmn?

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Haroon Niaz boolean (bit) type.

    • @haroonniaz7148
      @haroonniaz7148 7 ปีที่แล้ว

      (x => x.IsDeleted == false && x.EmployeeId=EmployeeId); is still show error && operator canot applied on
      bool and int

    • @haroonniaz7148
      @haroonniaz7148 7 ปีที่แล้ว

      thanks sir error remove and code execute

  • @narendarsingh4672
    @narendarsingh4672 6 ปีที่แล้ว

    Great

  • @jimboTTT
    @jimboTTT 7 ปีที่แล้ว

    Thanks sir!

  • @MrBobadil
    @MrBobadil 8 ปีที่แล้ว

    How would we show in the modal, what record is going to be deleted? Do we need a partial view for that?

    • @aapkanigam
      @aapkanigam  8 ปีที่แล้ว

      +MrBobadil If you want to display simple message then you can use modal with hard coded message ..but if you want to show complete value of that record then you need partial view with bootstrap modal

  • @kiranallam3583
    @kiranallam3583 6 ปีที่แล้ว

    Good tutorial Ashish, while I am debugging ,I am not able to find the EmployeeId in the DeleteEmployee method parameter

    • @aapkanigam
      @aapkanigam  6 ปีที่แล้ว

      Thanks.. You need to make sure whether you are getting employeeId while rendering data or not

    • @kiranallam3583
      @kiranallam3583 6 ปีที่แล้ว

      yes I am getting the id in view but it is not passed to JSON method and one more thing while I am deleting the element, it is going to be deleted. as soon as i was refreshing the page same element is coming back in the view

    • @aapkanigam
      @aapkanigam  6 ปีที่แล้ว

      Then you should check your jquery code how are you passing the ID in ajax call. Make sure the name of Id key should be exactly matches with the method's parameter name in your controller.

    • @kiranallam3583
      @kiranallam3583 6 ปีที่แล้ว

      Ok Ashish Thank you

  • @MrJose1196
    @MrJose1196 7 ปีที่แล้ว

    What is the query you use to start 0 the column is delete?

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Jose Angel You can watch part 26 for this..

  • @kinkmas
    @kinkmas 7 ปีที่แล้ว

    Thank you :)

  • @annuverma936
    @annuverma936 6 ปีที่แล้ว +1

    why use json result on delete method why not action result ?

    • @list5s
      @list5s 6 ปีที่แล้ว

      because it gives a data in JSON format that why use this JSON result

  • @zahidulemon5058
    @zahidulemon5058 7 ปีที่แล้ว

    sir why i use JsonResult ,return Json(result, JsonRequestBehavior.AllowGet) etc. can you please explain why we use Json for delete operation.

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Zahidul Emon through jquery when you select type as json the all request and response will be sent or recieved in json format.

  • @tayyabjatoi8644
    @tayyabjatoi8644 4 ปีที่แล้ว

    What is data type of IsDeleted in Sqlserver?

    • @aapkanigam
      @aapkanigam  4 ปีที่แล้ว +1

      Choose bit in sql

  • @nabeelsiddiqui7612
    @nabeelsiddiqui7612 4 ปีที่แล้ว

    Your CODE BELOW LINk is not working? why Sir?

  • @carlosgabriel8568
    @carlosgabriel8568 7 ปีที่แล้ว

    Hi, I'm using in my ajax succses "myModal".modal("hide") but after i complete my action(Add, Delete or edit) my moal dialog it's not closing, someone know's what's wrong?

  • @kuldeepkumar-en1fk
    @kuldeepkumar-en1fk 7 ปีที่แล้ว +1

    Sir, Why you have used JSON. Please Explain

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +kuldeep kumar where?

    • @kuldeepkumar-en1fk
      @kuldeepkumar-en1fk 7 ปีที่แล้ว

      sir you have used "Jsonresult". please Explain.

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว +1

      +kuldeep kumar oh..this will give you data into JSON format..and this data will be received into ajax response.

    • @kuldeepkumar-en1fk
      @kuldeepkumar-en1fk 7 ปีที่แล้ว

      thank you sir

  • @muhammadalwi4842
    @muhammadalwi4842 6 ปีที่แล้ว

    Hallo sir
    What is data type you used on Isdelete column ?

    • @aapkanigam
      @aapkanigam  6 ปีที่แล้ว

      Bit in sql and boolean in c#

    • @muhammadalwi4842
      @muhammadalwi4842 6 ปีที่แล้ว

      @@aapkanigam thanks you so much sir

    • @xhonb3436
      @xhonb3436 4 ปีที่แล้ว

      'The specified type member 'IsDeleted' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.'
      why this problem occurs?

  • @lutforurc
    @lutforurc 8 ปีที่แล้ว

    Dear Sir,
    Great video, but How can insert multiple data at a time. Please help me?

    • @aapkanigam
      @aapkanigam  8 ปีที่แล้ว

      +Lutfor Rahman multiple datetime means..? use DateTime.Now for current date time

    • @lutforurc
      @lutforurc 8 ปีที่แล้ว

      Dear Sir,
      I didn't mean datetime. I just said that how to insert multiple DATA at once using ajax.

    • @aapkanigam
      @aapkanigam  8 ปีที่แล้ว +1

      +Lutfor Rahman Just use $.each function to send data one by one ..or create object of data and send to ajax

    • @lutforurc
      @lutforurc 8 ปีที่แล้ว +1

      Thank you very much.

  • @mohammadfasih7752
    @mohammadfasih7752 8 ปีที่แล้ว

    sir please explain little bit more this line...(viewBag.DepartmentList=new SelectList(List,"Departmentid","DepartmentName")
    what changes can i do if my table has no dependency with another tale

    • @aapkanigam
      @aapkanigam  8 ปีที่แล้ว +1

      +Faizan Raza I have list of record in "List" in which I will have all columns.But here while taking it into ViewBag.DepartmentList I am taking list of two column only i.e. DepartmentName and DepartmentId .I will use this list to bind my Dropdown that needs only id and name.
      SelectList is like tag which contains Name and value .

    • @aapkanigam
      @aapkanigam  8 ปีที่แล้ว +1

      +Faizan Raza No, this is just the list which will contains list of DepartmentId and its Name .

  • @duncanmcdonald5250
    @duncanmcdonald5250 7 ปีที่แล้ว

    If, like me, you wonder how to set up the "FK_Sites_Employee" key that Ashish uses, but has not explained how to create, I'd advise going to the blog for Tut 28 and grabbing the database creation SQL. The database SQL attached to this tutorial does not successfully set up the foreign key for me.

    • @duncanmcdonald5250
      @duncanmcdonald5250 7 ปีที่แล้ว

      You will also need to update the entity framework to include the new "IsDeleted" field in the Employee table. So open the "MVCTutorialModel.edmx" in the "Models" folder, right click and select "Update Model From Database", Select the "Refresh" tab and click the "Finish" button. Now build the project again and the Employees class will have the new "IsDeleted" member. But your EmployeeViewModel will need to be manually updated to know about this field.
      Also, don't expect this tutorial to actually DELETE anything from the table, it just updates and uses the new flag.

  • @mohitgangwar1191
    @mohitgangwar1191 7 ปีที่แล้ว

    The AJAX request is sent and it works. But, It works only for the first time, it doesnt work from second time onwards. please give the solution

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Mohit Gangwar try to debug using inspect element in your browser . You will see some error.

  • @samzviews6315
    @samzviews6315 7 ปีที่แล้ว

    Uncaught ReferenceError: ConfirmDelete is not defined
    at HTMLAnchorElement.onclick
    i AM GETTING THIS ERROR PLS ANY SOLUTION WHY IT IS ?

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Sheshmani Pandey Sam Make sure to create that method in script tag

    • @samzviews6315
      @samzviews6315 7 ปีที่แล้ว

      Technotips - Ashish i dint see any method in script tag in your video can u please send me in comment plss i am stucked there

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +Sheshmani Pandey Sam var ConfirmDelete = function (EmployeeId) { $("#hiddenEmployeeId").val(EmployeeId); $("#myModal").modal('show'); } var DeleteEmployee = function () { $("#loaderDiv").show(); var empId = $("#hiddenEmployeeId").val(); $.ajax({ type: "POST", url: "/Test/DeleteEmployee", data: { EmployeeId: empId }, success: function (result) { $("#loaderDiv").hide(); $("#myModal").modal("hide"); $("#row_" + empId).remove(); } }) }

  • @kartikeypavar6585
    @kartikeypavar6585 5 ปีที่แล้ว

    Event_details evnt=db.Event_details.SingleOrDefault(×=>x.IsDeleted==false && x.E_id== E_id); IsDeleted is error pls help me sir

  • @johanvanwambeke723
    @johanvanwambeke723 7 ปีที่แล้ว +3

    Loved it ! shake that boodystrap !

    • @aapkanigam
      @aapkanigam  7 ปีที่แล้ว

      +johan Van Wambeke Thanks