Mayur Dhavle

Mayur Dhavle

  • NA
  • 119
  • 24k

DevExpress MVCGridView

Sep 12 2014 10:30 AM

Need a help in DevExpress. I have a custom button inside a Gridview. What I want is to create a ViewModel object when a user clicks on it.

Please revert me with possible solutions/suggestions.

@{
var grid = Html.DevExpress().GridView(settings =>
{
.
.
GridViewCommandColumnCustomButton editBtn1 = new GridViewCommandColumnCustomButton();

editBtn1.ID = "Button1";

editBtn1.Image.Url = "~/Images/icons/manage_scrap_enable.png";
editBtn1.Text = "Details";
editBtn1.Image.IsResourcePng = true;
editBtn1.Visibility = GridViewCustomButtonVisibility.AllDataRows;
 var ccAdd = new MVCxGridViewCommandColumn();
ccAdd.CustomButtons.Add(editBtn1); 
...
 
}
 
 
Now on click of editButton1 I want to pass rowdata {column cell values}  to a MVC Controller action method as a Model object.
 
If it is a normal hyperlink or a button; we can create object of Model class inside a DataItemTemplate; but this is a custom button.
 
Please refer : http://www.devexpress.com/Support/Center/Example/Details/E4058 for sample implementation with normal GridViewColumn
 
 

Answers (1)