Hi Aleksandar,
Beleive me i made everything... all steps but still not working... This is my grid
@(Html.Kendo().Grid<
MockUpForeNet.Controllers.CardDetailController.Limits
>()
.Name("limitgrid").AutoBind(true)
.DataSource(dataBinding => dataBinding.Ajax()
.Read("GridLimitBinding", "CardDetail",new { rule = rule }).Update("UpdateLimit", "CardDetail")
.Model(keys =>
{
keys.Id(c => c.Id);
keys.Field(c => c.Id).Editable(false);
keys.Field("DurationType", typeof(string)).Editable(true);
keys.Field("DurationValue", typeof(string)).Editable(true);
keys.Field("ValueType", typeof(string)).Editable(true);
keys.Field("MaxValue", typeof(string)).Editable(true);
}).Batch(true).ServerOperation(false)
)
.Events(e => e.DataBound("hidecolumn1"))
.Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InCell))
.ToolBar(commands =>
{
commands.Save().SaveText(" ").CancelText(" ");
})
.Columns(columns =>
{
columns.Bound(e => e.MaxValue).Width(200).Title("Limit").ClientTemplate("#= ValueType == 'Amount' ? Row(MaxValue) : RowLiters(MaxValue) #");
columns.Bound(e => e.ValueType).Width(200).Title("Type").EditorTemplateName("ValueType");
columns.Bound(e => e.DurationValue).Width(200).Title("Duration");
columns.Bound(e => e.DurationType).Width(200).Title("Duration Type").EditorTemplateName("DurationType");
columns.Bound(e => e.Id).Visible(false);
columns.Bound(e => e.Id).Width(80).ClientTemplate("<
img
src
=
'../../assets/images/icons/delete.svg'
id
=
'#=Id#'
/>").Filterable(false).IncludeInMenu(false).Title(" ");
})
.Sortable()
.Navigatable(configurator => configurator.Enabled(true))
)
This is my editor
@(Html.Kendo().DropDownList()
.Name("cbvaltype").OptionLabel("-Select-").ValuePrimitive(true)
.Items(i =>
{
i.Add().Text("Quantity").Value("Quantity");
i.Add().Text("Amount").Value("Amount");
})
)
And this is my controller..
public
class
Limits
{
public
int
Id {
get
;
set
; }
public
string
DurationType {
get
;
set
; }
public
string
DurationValue {
get
;
set
; }
public
string
ValueType {
get
;
set
; }
public
string
MaxValue {
get
;
set
; }
}
public
ActionResult GridLimitBinding([DataSourceRequest]DataSourceRequest request,
string
rule)
{
var result = (from a
in
test.MgCFraud
where a.CfdCfeId == rulelimitid
select a).FirstOrDefault();
List<Limits> listLimits =
new
List<Limits>();
if
(result !=
null
)
{
Limits d =
new
Limits();
d.Id = resultMgCardFraudDet.CfdIdent;
d.DurationType = result.CfdDurTyp;
d.DurationValue = result.CfdDurVal;
d.ValueType = resultCfdMaxTyp;
d.MaxValue = result.CfdMaxVal;
listLimits.Add(d);
}
else
{
Limits d =
new
Limits();
d.Id = 0;
d.DurationType =
""
;
d.DurationValue =
""
;
d.ValueType =
""
;
d.MaxValue =
""
;
listLimits.Add(d);
}
return
Json(listLimits.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
Here my detail please help me i stucked on this.....