This is a migrated thread and some comments may be shown as answers.

Posting ASp.net MVC form having KendoUi extensions.

0 Answers 45 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 11 Feb 2014, 07:42 AM
I am developing my ASp.net MVC application using Kendoui MVC extensions. So In my form I have all the kendoui grid, dropdown, datepicker etc... I have accumulated them all in my @using(Html.BeginForm ()) But I am not sure How do i post my form data to the controller. If anybody has done that could you please shre your experience.

For example:

I have two entities: Faculty and FacultyType in My DAL

​public class Faculties
{
    public int FacultyId { get; set; }
    public string StaffNumber { get; set; }

    public int FacultyTypeId { get; set; }
    public virtual FacultyTypes FacultyTypes { get; set; }
}

public class FacultyTypes
{
    public FacultyTypes()
     {
       this.Faculties = new List<Faculties>();
      }
    public int FacultyTypeId { get; set; }
    public string FacultyTypeCode { get; set; }
    public string FacultyType { get; set; }
    public bool IsDefunct { get; set; }
    public virtual ICollection<Faculties> Faculties { get; set; }
}


I have my ViewModels in my application:

​public class ViewModelFaculty
{
    public int FacultyId { get; set; }
    public string StaffNumber { get; set; }

    public ViewModelFacultyTypes FacultyType { get; set; }
}

public class ViewModelFacultyTypes
{

    [ScaffoldColumn(false)]
    public int FacultyTypeId { get; set; }

    [Required(ErrorMessage ="Faculty Type Code is Required")]
    public string FacultyTypeCode { get; set; }

    [Required]
    public string FacultyType { get; set; }

     public bool IsDefunct { get; set; }

}

My View page having kendoui extensions for ASp.net MVC.

@using(Html.BeginForm())
{
<fieldset>
<legend class="main">Personal Particulars</legend>
<div class="view-table">
<div class="view-row">
<div class="view-name"><label for="staffId">Staff ID</label></div>
<div class="view-name"><input id ="txtStaffId" name="StaffId" class="k-textbox" data-bind="value: StaffId" type="text" required /></div>
<div class="view-name"><label for="facultyType">Faculty Type</label></div>
<div class="view-name">
@(Html.Kendo().DropDownList()
.Name("ddFacultyType")
.DataTextField("FacultyType")
.DataValueField("FacultyTypeId")
.OptionLabel("Select Faculty Type")
.Enable(true)
.AutoBind(true)
.DataSource(ds =>
{
ds.Read(read =>
{
read.Action("GetFacultyTypes", "NewFaculty");
})
.ServerFiltering(true);
})

)
</div>
</div>
}

I am showing a part of my view as if I could post two fields then rest all will be of same logic.
So now when I submit my form I need to post the data in the form to controller.
Even kendoUi website as also not given any end to end example of how to use the extensions in a form and how to post the data.

If anyone has been working in same enviorment or any direction on how to do please suggest me.

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Steve
Top achievements
Rank 1
Share this question
or