.

how to Deletet Row in gridview with button devexpress mvc

Deletet Row in gridview with button devexpress mvc,Button Deletet Row devexpress mvc,Button Deletet Row devexpress mvc

Deletet Row in gridview with button devexpress mvc,Button Deletet Row devexpress mvc,Button Deletet Row devexpress mvc

To Delete Row in gridview with button devexpress mvc :

1- Index.cshtml



Button Delete Row in gridview devexpress  mvc


<div class="panel panel-primary col-lg-12">
    <div class="panel-heading">
        <h3 class="panel-title">Grid Test</h3>
    </div>
    <div class="pull-right">
        @Html.DevExpress().Button(settings =>
   {
       settings.Name = "btnDelete";
       settings.Text = "Delete";

       settings.UseSubmitBehavior = true;
       settings.ClientSideEvents.Click = "function(s, e) { OnDeleteClick() }";

   }).GetHtml()

2- javascript code 
 


 javascript Button  Delete Row in gridview devexpress  mvc


@model DXWeb.Models.Home

 <script type="text/javascript">
  
 function OnDeleteClick(sender, e)
     {
         if (confirm("Do you want to delete this Row ?"))
             var index = GridViewTest.GetFocusedRowIndex();
         GridViewTest.DeleteRow(index);

     }
</script>

3- Controller:
 


Controller Button Delete Row in gridview devexpress  mvc


 public ActionResult GridTest()
        {
            var model = db.test;
            return PartialView("_GridViewPartialTest", model.ToList());

        }

Note: add " settings.SettingsBehavior.ConfirmDelete = true; " in your Gridview .




Labels:

Post a Comment

The World of Technology

{facebook#https://www.facebook.com/theworldoftechnologyy/}

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget