Databinding RadGrid

Thread is closed for posting
3 posts, 0 answers
  1. GrZeCh
    GrZeCh avatar
    98 posts
    Member since:
    Dec 2007

    Posted 05 Jun 2009 Link to this post

    Hello,
    I'm trying to databind RadGrid control using method provided on this page:

    http://www.telerik.com/help/aspnet-ajax/mvc-radgrid-databinding.html

    <
       RadGrid1.DataSource = ViewData["Customers"]; 
       RadGrid1.DataBind(); 
    %> 
    <telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false"
    .... 
    but when I try to run it I'm getting 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. 
    on the line with .....DataBind();

  2. Dallas Sehlhorst
    Dallas Sehlhorst avatar
    19 posts
    Member since:
    Feb 2006

    Posted 05 Jun 2009 Link to this post

    Go here: http://www.telerik.com/help/aspnet-ajax/mvc-getting-started.html and start from a new MVC app.  I bet you didn't register a RadScriptManager and its related handler.

    -Dallas
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. GrZeCh
    GrZeCh avatar
    98 posts
    Member since:
    Dec 2007

    Posted 05 Jun 2009 Link to this post

    in web.config I have in <handlers>:

                <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/> 
                <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/> 
                <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/> 
                <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/> 
                <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/> 

    and in <httphandlers>:
                <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0"/> 
                <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0"/> 
                <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0"/> 
                <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode,runtimeVersionv2.0"/> 
                <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode,runtimeVersionv2.0"/> 

    and in my MasterPage file I use RadScriptManager

    EDIT. It started working when I copied exactly RadGrid from this site:

    http://www.telerik.com/help/aspnet-ajax/mvc-radgrid-databinding.html

    instead of using my RadGrid which I thought is "MVC friendly".



Back to Top