This question is locked. New answers and comments are not allowed.
When trying to render the grid in a partial view via an ajax request it appears to always fail...
The culprit is this check for the first script being telerik.common, which it never will be, it
will be an asset with an encrypted name. This should be fixed...
if
(IsSelfInitialized)
{
writer.AddAttribute(HtmlTextWriterAttribute.Type,
"text/javascript"
);
writer.RenderBeginTag(HtmlTextWriterTag.Script);
if
(ViewContext.HttpContext.Request.IsAjaxRequest())
{
var registrar = ScriptRegistrar.Current;
registrar.ScriptableComponents.Clear();
registrar.ScriptableComponents.Add(
this
);
try
{
var dependencies = registrar.CollectScriptFiles();
var common = dependencies.First(file => file.Contains(
"telerik.common"
));
var buffer =
new
StringWriter();
WriteInitializationScript(buffer);
var initializationScript =
"jQuery.telerik.load({0},function(){{ {1} }});"
.FormatWith(
new
JavaScriptSerializer().Serialize(dependencies),
buffer.ToString());
writer.WriteLine(
"if(!jQuery.telerik){"
);
writer.WriteLine(
"jQuery.ajax({"
);
writer.WriteLine(
"url:\"{0}\","
.FormatWith(common));
writer.WriteLine(
"dataType:\"script\","
);
writer.WriteLine(
"cache:false,"
);
writer.WriteLine(
"success:function(){"
);
writer.WriteLine(initializationScript);
writer.WriteLine(
"}});}else{"
);
writer.WriteLine(initializationScript);
writer.WriteLine(
"}"
);
}
catch
(FileNotFoundException)
{
WriteInitializationScript(writer);
}
}
else
{
WriteInitializationScript(writer);
}
writer.RenderEndTag();
}