problems with editable grid

Apr 2, 2014 at 4:40 PM
Edited Apr 2, 2014 at 5:15 PM
Hi, I want to create an editable gridview,

when I click the edit button I send the information of the columns for actionresult,
I want to get changed in the dropdown "sexo".
example code:


...
         {                         
                 columns.Add(c => c.Sexo)
                .Encoded(false)
                .Sanitized(false)
                .SetWidth(30)
.RenderValueAs(c => Html.DropDownList("sexo", items, c.Sexo)).Titled("Sexo");
       columns.Add()
        .Encoded(false)
        .Sanitized(false)
        .SetWidth(30)
        .RenderValueAs(c =>
            @<b> 
                @Html.ActionLink("Edit", "gridEdit", "Home", new {@Sexo = @Sexo}, null)
            </b>);
                }).WithPaging(10).Sortable(true); 
Controller:
public ActionResult gridEdit(object Sexo)
    { ...
thank's for your atencion
Coordinator
Apr 5, 2014 at 7:55 AM
Hi

You need to solve the problem by creating an custom javascript code.

First, Attach an dropdown change event:
Then you can send an ajax request to update the field:
$(function(){
    $("select").on("change" , function(){
              $.post( /*url to gridEdit url */, $(this).val()); 
    });
});