asp.net mvc - nopcommerce: telerik grid link item cannot find parameter (Id is not defined) -
i have added new menu, new controller , new view in nop.admin project. want bind edit link inside rad grid in nop.admin. code is.
@(html.telerik().grid<nop.admin.models.authorizeworkshops.registrationmodel>() .name("productregistration-grid") .columns(columns => { columns.bound(x => x.registeredproducts.make); columns.bound(x => x.registeredproducts.model); columns.bound(x => x.registeredproducts.year); columns.bound(x => x.registeredproducts.cc); columns.bound(x => x.registeredproducts.authorizedworkshop); columns.bound(x => x.registeredproducts.purchasedate); columns.bound(x => x.registeredproducts.inoiceno); columns.bound(x => x.registeredproducts.serialno); columns.bound(x => x.registeredproducts.id) .template(x => html.actionlink(t("admin.common.edit").text, "edit", new { id = x.registeredproducts.id })) .clienttemplate("<a href=\"edit/<#= id #>\">" + t("admin.common.edit").text + "</a>") .width(50) .centered() .headertemplate(t("admin.common.edit").text) .filterable(false); }) .pageable(settings => settings.pagesize(gridpagesize).position(gridpagerposition.both)) .databinding(databinding => databinding.ajax().select("list", "productregistration")) .enablecustombinding(true))
**if exclude following code**
columns.bound(x => x.registeredproducts.id) .template(x => html.actionlink(t("admin.common.edit").text, "edit", new { id = x.registeredproducts.id })) .clienttemplate("<a href=\"edit/<#= id #>\">" + t("admin.common.edit").text + "</a>") .width(50) .centered() .headertemplate(t("admin.common.edit").text)
rad grid in view works fine , return me records. **but if continue same** following error.
uncaught referenceerror: id not defined
please me issue. thanks.
it took 5 hours identify issue behind scene. actaully using model returning multiple models. replaced
.clienttemplate("<a href=\"edit/<#= id #>\">" + t("admin.common.edit").text + "</a>")
** **
.clienttemplate("<a href=\"edit/<#= registeredproducts.id #>\">" + t("admin.common.edit").text + "</a>")
and worked.
thanks god.
Comments
Post a Comment