Hello,i am a computer science student ,working for a small software company and totally newbie about KendoUI.
I have a MVC project that connects to database ,get and shows data's on KendoUI grid.I would like to use combobox on my custom editor template with KendoUI grid pop up.
There is Kendo combobox on Index page.It fetchs and shows records from db with selected column().
I am using Kendo grid - pop up as a interface.There are add,edit, and update buttons.When i click add or edit button pop up screen opens which is related to my custom template.Every command is working well(add,edit,delete)
The problem is when i add Kendo combobox to my custom editor template , it shows nothing on grid.Edit and delete buttons are missing and when i click to add button it shows this ajax code.It looks like some problem about rendering.
Here is my Kendo combobox code:
Getting data controller for combobox -
Another controller to get,create ,update etc.
My custom editor template:
I have also DataAccess methods to control data.I can post them if it is needed.
He is the almost same problem with me: stackoverflow
I have a MVC project that connects to database ,get and shows data's on KendoUI grid.I would like to use combobox on my custom editor template with KendoUI grid pop up.
There is Kendo combobox on Index page.It fetchs and shows records from db with selected column().
I am using Kendo grid - pop up as a interface.There are add,edit, and update buttons.When i click add or edit button pop up screen opens which is related to my custom template.Every command is working well(add,edit,delete)
The problem is when i add Kendo combobox to my custom editor template , it shows nothing on grid.Edit and delete buttons are missing and when i click to add button it shows this ajax code.It looks like some problem about rendering.
{"Data":[],"Total":4,"AggregateResults":null,"Errors":null}
Here is my Kendo combobox code:
@(Html.Kendo().ComboBox()
.Name(
"productComboBox"
)
//The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
.DataTextField(
"ALLERGYTYPE"
)
//Specifies which property of the Product to be used by the combobox as a text.
.DataValueField(
"ID"
)
//Specifies which property of the Product to be used by the combobox as a value.
// .Filter(FilterType.Contains)
.Placeholder(
"ALLERGYTYPE"
)
.DataSource(source =>
{
source.Read(read =>
{
read.Action(
"GetProducts"
,
"AllergiesData"
);
//Set the Action and Controller name
})
.ServerFiltering(
true
);
//If true the DataSource will not filter the data on the client.
})
Getting data controller for combobox -
public
JsonResult GetProducts()
{
PHRDevEntities patient =
new
PHRDevEntities();
return
Json(patient.PR_PATIENTALLERGY, JsonRequestBehavior.AllowGet);
}
Another controller to get,create ,update etc.
public
ActionResult Get([DataSourceRequest]DataSourceRequest request)
{
return
Json(DataAccess.Get(request), JsonRequestBehavior.AllowGet);
}
public
ActionResult CreateSingle([DataSourceRequest]DataSourceRequest request, TEntity itemNew)
{
return
Json(DataAccess.Create(request, itemNew.ToArrayFromObject(),
false
, ModelState), JsonRequestBehavior.AllowGet);
}
public
ActionResult Create([DataSourceRequest]DataSourceRequest request, [Bind(Prefix =
"models"
)]IEnumerable<TEntity> itemsNew)
{
return
Json(DataAccess.Create(request, itemsNew,
true
, ModelState));
}
public
ActionResult UpdateSingle([DataSourceRequest]DataSourceRequest request, TEntity itemUpdated)
{
return
Json(DataAccess.Update(request, itemUpdated.ToArrayFromObject(),
false
, ModelState), JsonRequestBehavior.AllowGet);
}
public
ActionResult DestroySingle([DataSourceRequest]DataSourceRequest request, TEntity itemToDelete)
{
return
Json(DataAccess.Destroy(request, itemToDelete.ToArrayFromObject(),
false
, ModelState), JsonRequestBehavior.AllowGet);
}
My custom editor template:
@model KendoUIMvcApplication1.DATA.PR_PATIENTALLERGY
<strong>PR_PATIENTALLERGY</strong> <br />
<table width=
"100%"
cellspacing=
"5"
style=
"margin:20px"
>
<tr>
<td width=
"10%"
>@Html.LabelFor(model => model.PATIENTID)</td>
<td width=
"40%"
>@Html.EditorFor(model => model.PATIENTID)
@Html.ValidationMessageFor(model => model.PATIENTID)</td>
<td width=
"10%"
>@Html.LabelFor(model => model.DOCTOR)</td>
<td width=
"40%"
>@(Html.Kendo().ComboBox()
.Name(
"productComboBox"
)
//The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
.DataTextField(
"ALLERGYTYPE"
)
//Specifies which property of the Product to be used by the combobox as a text.
.DataValueField(
"ID"
)
//Specifies which property of the Product to be used by the combobox as a value.
// .Filter(FilterType.Contains)
.Placeholder(
"ALLERGYTYPE"
)
.DataSource(source =>
{
source.Read(read =>
{
read.Action(
"GetProducts"
,
"AllergiesData"
);
//Set the Action and Controller name
})
.ServerFiltering(
true
);
//If true the DataSource will not filter the data on the client.
})
//.SelectedIndex(0) //Select first item.
)
@Html.ValidationMessageFor(model => model.DOCTOR)</td>
</tr>
<tr>
<td width=
"10%"
>@Html.LabelFor(model => model.ISACTIVE)</td>
<td width=
"40%"
>@Html.EditorFor(model => model.ISACTIVE)
@Html.ValidationMessageFor(model => model.ISACTIVE)</td>
</tr>
</table>
He is the almost same problem with me: stackoverflow