This is a migrated thread and some comments may be shown as answers.
DynamicRadgrid on an existing website
4 Answers 42 Views
This is a migrated thread and some comments may be shown as answers.
andy
Top achievements
Rank 1
andy asked on 10 Dec 2010, 10:29 PM
There are several examples to enable Dynamic Data support on a gridview without using the full Dynamic Data scaffolding (global.asax + dynamicdata folder) such as on this video

I followed along with the example as shown in the video and I was able to get gridview to work correctly with dynamic support.

However, the same steps do not work with DynamicRadGrid. I get the error:
Could not determine a MetaTable. A MetaTable could not be determined for the data source 'EntityDataSource1' and one could not be inferred from the request URL. Make sure that the table is mapped to the dats source, or that the data source is configured with a valid context type and table name, or that the request is part of a registered DynamicDataRoute.

Here are steps I took:
1. In the Page_Init:
RadGrid1.EnableDynamicData(typeof(Plan));
2. Made a MetaData Class:
[MetadataType(typeof(PlanMD))]
    public partial class Plan
    {
        public class PlanMD
        {
            [StringLength(50), Required]
            public string Name { get; set; }
        }
    }
3. Added a validation summry on the page
4. Add a dynamicradgrid on the page with DynamicColumn
<dynamic:DynamicRadGrid ID="RadGrid1" runat="server" AllowAutomaticInserts="True"
            AllowAutomaticUpdates="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
            AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" DataSourceID="EntityDataSource1"
            GridLines="None">
            <MasterTableView AllowAutomaticInserts="False" CommandItemDisplay="Top" DataKeyNames="Id"
                DataSourceID="EntityDataSource1">
                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <dynamic:DynamicGridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name">
                    </dynamic:DynamicGridBoundColumn>
  
                </Columns>
            </MasterTableView>
        </dynamic:DynamicRadGrid>


Please advise if DynamicRadgrid is even designed to work in this scenario. Thanks

4 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 16 Dec 2010, 02:03 PM
Hi Andy,

I am sending you a simple example which demonstrates the DynamicRadGrid with validation. If you try to delete some parent record or try to update items without value in required field the validation will be fired and the validation summary will show the error message. Please check out the example and let me know if it helps you. Also please check out the following online resources:

http://blogs.telerik.com/atanaskorchev/posts/08-08-13/yet_another_update_of_radcontrols_for_asp_net_ajax_dynamicdata_support.aspx
http://blogs.telerik.com/blogs/posts/08-05-22/radcontrols_and_asp_net_dynamic_data_-_update.aspx
http://blogs.telerik.com/nikolayrusev/posts/10-07-29/radcontrols_for_asp_net_ajax_dynamic_data_update.aspx

Additionally from the posted code I saw that you use RadGrid1.EnableDynamicData() method, however the RadGrid and the current implementation of the DynamicRadGrid do not have such a method.

Looking forward for your reply.

Greetings,
Radoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Michael
Top achievements
Rank 1
answered on 16 Dec 2010, 07:14 PM
This code does not run:

Line 114:
Line 115:            List<string> list = new List<string>();
Line 116:            foreach (MetaColumn column in metaTable.PrimaryKeyColumns)
Line 117:            {
Line 118:                list.Add(column.Name);
   
  
Source File: c:\TEMP\238051_Example\Example\App_Code\DynamicRadGrid.cs    Line: 116 
  
Stack Trace: 
  
  
[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.DynamicData.DynamicRadGrid.OnInit(EventArgs e) in c:\TEMP\238051_Example\Example\App_Code\DynamicRadGrid.cs:116
   System.Web.UI.Control.InitRecursive(Control namingContainer) +140
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Control.InitRecursive(Control namingContainer) +311
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +480
  
  
0
Michael
Top achievements
Rank 1
answered on 16 Dec 2010, 07:16 PM

Also, please note that the originl question is about being able to run DynamicRadgrid on an existing web application, which means that if a user was to create a brand new page (for example in the root of the website), and try to use dynamic data features, the grid view appears to work but not dynamicradgrid.

 

The dynamicradgrid appears to have a tight dependence on routing, whereas grid view can make use of dynamic features without routing also.

0
Radoslav
Telerik team
answered on 21 Dec 2010, 12:12 PM
Hi Ninh,

Regarding your first ticket:
Could you please verify that you do not convert the application to the .NET 4.0, because this exception could be thrown if the application is converted to .NET 4.0 with the automatic VS conversion tool( when you load the solution into the VS if you use VS 2010 the "convert to .NET 4.0" window will be shown).

Regarding your last ticket:
The DynamicRadGrid could not work without routing. Also adding it into the existing web application is not supported scenario.

Looking forward for your reply.

Kind regards,
Radoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
andy
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Michael
Top achievements
Rank 1
Share this question
or