mardi 7 juillet 2015

how to call declarative helper from jquery ajax in asp.net mvc

I have this declarative helper , Its generate dynamic form according to parent code in dropdown . I want when user change dropdown ,Call Helper and get result and show to the user . my code :

@helper GetSubGroupFields(List<DomainModel.Entities.Field> fields)
{
foreach (var item in fields)
        {
<span class="title" >@item.Title</span><br />
<input type="hidden" name="fields" value="@item.Id" />
    if (item.FieldType==DomainModel.Entities.FieldType.Text)
    {

<input type="text" name="fieldvalue" /><br />
    }
    else if (item.FieldType == DomainModel.Entities.FieldType.Select)
    {
        <select name="fieldvalue">
            @foreach (var fieldvalues in item.Items)
            {
                <option value="@fieldvalues.Id"> @fieldvalues.Name</option>
            }
        </select><br />

    }
    }
}

How can I do this ?

Aucun commentaire:

Enregistrer un commentaire