I am developing asp.net mvc application and I started using Telerik Extensions for ASP.NET MVC. There seems to be minimal documentation on these controls, as compared to say the RadControls which comes with a downloadable 48mb PDF documentation on controls and applications.
But my ASP.NET MVC application needs AJAX functionality and it doesn't appear to me the Telerik Extension controls have been built to work with Ajax--they can work with it but you need to write it all yourself.
I started trying the Radcontrols, and found through the way both are configured, it seems you can have ONE or the OTHER e.g. not both extension controls and radcontrols. And also, the radcontrols seem NOT built for MVC and do not seem to fit at all with that model.
So the RadGrid has caching but the telerik extensions grid doesn't !?
RadGrid & all controls have plenty of documentation.
So am I missing doco for the extension controls, or are they just poorly documented, and superceded by RadControls.
Finding this increidbly frustrating that I cannot find a clear description on the wbesite what the controls can and can't be used for so I'm left to trial by error and find myself wasting alot of time.
Please explain Teleriks team!
6 Answers, 1 is accepted
RadControls for ASP.NET Ajax are based on ASP.NET Ajax and are typically used in WebForms applications. Most of the controls are compatible with ASP.NET MVC and you can check the online documentation with this regard. Have in mind though that Microsoft ASP.NET Ajax (UpdatePanel for example) does not work with ASP.NET MVC.
Telerik Extensions for ASP.NET MVC is our UI suite for ASP.NET MVC applications. It fully leverages the ASP.NET MVC platform and supports all popular features - model binding, validation, multiple view engines etc. The online documentation is available here. The online demos are here. Indeed if you need Ajax capability you need to implement it yourself. You can either use the ASP.NET MVC built-in ajax features or jQuery. This help article explains how. Telerik Extensions for ASP.NET MVC cannot be used in WebForm applications and do not play well with ASP.NET Ajax because of that.
Regards,
Atanas Korchev
the Telerik team
Thank you for your thorough reply.
Your answer begs the question, may I have both rad controls and telerik extensions in the same page?
Before when I was trying - it seems they conflict with each other, as radcontrols does not want <%: %> code in the head, and the telerik extensions require <%: %> in the head.
Thank you
The problem with the head tag is well known and its solution can be found here - wrap the <%: %> block inside a RadScriptBlock control.
In a word it is possible to use both component suites in the same ASP.NET MVC application. However using the MVC suite in a non-MVC application is not supported.
Atanas Korchev
the Telerik team
Unfortunately the General Troubleshooting page was unable to help me with this error I stumbled upon fairly quickly...
Example One: renders fine
In View:
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
<%
RadGrid1.DataSource = ViewData["Stuff"];
RadGrid1.DataBind();
%>
<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="False" GridLines="None">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="Omitted" HeaderText="Omitted" />
<telerik:GridBoundColumn DataField="Omitted" HeaderText="Omitted" />
<telerik:GridBoundColumn DataField="Omitted" HeaderText="Ommited" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
<br />
</form>
In controller:
public ActionResult Index()
{
ViewData["Stuff"] = GetAllStuff();
return View();
}
Example 2: I add paging. It does not render. I get this error.
Script controls may not be registered after PreRender.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Script controls may not be registered after PreRender.
Source Error:
Line 22: <%
Line 23: RadGrid1.DataSource = ViewData["Stuff"];
Line 24: RadGrid1.DataBind();
Line 25: %>
Line 26:
In View:
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
</telerik:RadScriptManager>
<%
RadGrid1.DataSource = ViewData["Stuff"];
RadGrid1.DataBind();
%>
<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="False" AllowPaging="True" GridLines="None">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="Omitted" HeaderText="Omitted" />
<telerik:GridBoundColumn DataField="Omitted" HeaderText="Omitted" />
<telerik:GridBoundColumn DataField="Omitted" HeaderText="Omitted" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
<br />
</form>
Controller code did not change.
|
Not all features of RadControls for ASP.NET Ajax work in ASP.NET MVC. Those are all features which require postback, ViewState or integration with ASP.NET Ajax (UpdatePanel etc). I suggest you check the known limitations help topic with this regard.
The built-in RadGrid pager relies on postbacks hence it will not work in ASP.NET MVC unless you add a <form runat="server"> in your view and nest the grid inside of it. However adding the <form runat="server"> makes your view a regular ASP.NET page.
RadControls for ASP.NET Ajax were implemented with ASP.NET Ajax and WebForms in mind. Using them inside an ASP.NET MVC application is possible but has its limitations - a lot of features will not work in ASP.NET MVC.
Telerik Extensions for ASP.NET MVC is the recommended product for ASP.NET MVC development.
Atanas Korchev
the Telerik team