ASP.NET MVC Devexpress Sil ve Güncelle Butonu


Devexpresste silme ve güncelleme butonlarını nasıl ekleyebileceğinizi anlatacağım.
Devexpress gridini oluşturduktan sonra silme ve güncelleme işlemleri için bir adet kolon oluşturuyoruz.
1
2
3
4
5
6
7
8
9
10
settings.Columns.Add(column =>
      {
          column.Caption = "İŞLEMLER";
          column.Width = 150;
          column.SetDataItemTemplateContent(x =>
          {
              ViewContext.Writer.Write("<a href='" + Url.Action("DeleteProduct", "Product", new { id = x.KeyValue }) + "' style='padding-right:10px;color:red;' class='btn fa fa-remove'>
Sil</a>");
ViewContext.Writer.Write("<a href='" + Url.Action
("EditProduct", "Product", new { id = x.KeyValue })
+ "' class='btn fa fa-edit' style='color:#18a689'> Düzenle</a>");
          });
      });
Bu noktada önemli olan new { id = x.KeyValue } kısmıdır. Bu kısımda id parametresine o satırdaki verinin idsini atamış oluyoruz.
Controller tarafında bu id’yi yakalamak için ise Action kısmına string id parametresini ekliyoruz.
1
public ActionResult DeleteProduct(string id)

Yorum Gönder

Yorum Yayınla (0)

Daha yeni Daha eski