I have created a plugin and added a telerik grid. This plugin is integrated in admin section under product variant. Its working fine and view of plugin is loaded successfully but when I click on "Add New" button it is throwing and script error "Microsoft JScript runtime error: Unable to get value of the property 'select': object is null or undefined"
Here is my code for telerik grid.
<div>
@(Html.Telerik().Grid<CountrySpecificPricingModel>()
.Name("CountrySpecificPricing-grid")
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select("ProductVariantCountryList", "CountrySpecificPricing", new { productVariantId = Model.ProductVariantId })
.Insert("ProductVariantCountrySpecificPriceInsert", "CountrySpecificPricing", new { productVariantId = Model.ProductVariantId })
.Update("ProductVariantCountryUpdate", "CountrySpecificPricing")
.Delete("ProductVariantCountryDelete", "CountrySpecificPricing");
})
.Columns(columns =>
{
columns.Bound(x => x.Country);
columns.Bound(x => x.CurrencyID);
columns.Bound(x => x.Price);
columns.Bound(x => x.OldPrice);
columns.Command(commands =>
{
commands.Edit();
commands.Delete();
})
.Width(180);
})
.ToolBar(commands => commands.Insert())
.ClientEvents(events => events.OnEdit("onProductVariantCountryEdit"))
.EnableCustomBinding(true))
<script type="text/javascript">
function onProductVariantCountryEdit(e) {
$(e.form).find('#Country').data('tDropDownList').select(function (dataItem) {
return dataItem.Value == e.dataItem['CountryID'];
});
}
</script>
</div>
I have created a template with name "ProductVariantCountry" under "Views\[ControllerName]folder\EditorTemplates" and also added "UIHint" attribute on property Country in my model.
I am new to MVC razor and if I am doing anything wrong please let me know. Please provide me required details to resolve this issue.
One more thing, I added a reference of Telerik.Web.Mvc.dll file in my plugin project and also added the namespace in web.config file (under Views folder) but after adding @using Telerik.Web.Mvc in my view, intelligences is not working. Please help me. Thanks in advance.