Custom button doesn't pass parametrs to controller

Nov 28, 2013 at 1:17 PM
Hi,
I have costumized a grid with button, I need to pass row data to the controller.
The grid have 30 rows but when i click the buttons the controller recive always the data of the first row, ignoring the value of the current row.

My Code Mvc- Razor:
In the grid:
@Html.Grid(Model).Columns(columns =>
{
   columns.Add()
   .Encoded(false)
   .Sanitized(false)
   .SetWidth(30)
   .RenderValueAs(o => __MyButton__(o));

   columns.Add(o => o.NDG)
   .Titled("NDG")
   .Filterable(true)
   .SetWidth(5);

}

where MyButton is :

@helper MyButton(Model R)
{
Html.BeginForm("SendEmail", "Email", new { NDG = R.NDG, eMail = R.eMail }, FormMethod.Post);
<input type="submit" value="Send mail" name="btnEmail" "/>
<label>@Html.DisplayFor(X => R.NDG)</label>

}

In the controller:

[HttpPost]
public string SendEmail(String NDG, string eMail)
    {
        string ObjM = "Mcv test " + NDG;

        //SendMailMessage();
        return "ok";

    }
In the controller NDG have Always the value of the first row of the grid.
Please, can you help me?

Thanks,
Claudia
Dec 19, 2013 at 1:46 AM
Hello ,

This discussion area only for codeplex issues. It looks like your request would be better directed toward the specific project you are using. I encourage you to use the discussion service or issue tracker for the project you are interested in.
Marked as answer by kedavid on 12/23/2013 at 9:24 PM