2

I'm stumped over here.

I'm working on an page in application that uses Telerik RadGrids. I'd like to think it's pretty straight forward. Each row in the grid has an EditFormSettings Template set. There is a DropDownList and a Panel inside it. The DropDownList contains a number of different reports to display so when a user picks something, a UserControl is dynamically added to this panel and a report is shown, which is either another RadGrid or a RadRadialGauge inside a previously made UserControl. That functionality works as it should.

The problem comes when I go to expand another row if a RadGrid was loaded inside this panel. The following error is displayed:

*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.ArgumentException: Invalid JSON primitive: .*

This does not happen if the RadRadialGauge was first loaded and I go to expand another row. Only if it was the UserControl with the RadGrid. This UserControl is very elementary so I don't think there's anything in there over the top that could be the culprit.

Some code to help explain what I wrote.

<EditFormSettings EditFormType="Template">
    <FormTemplate> 
        <div id="dashboardExpandedTemplate">                            
            <asp:DropDownList ID="ddlReportsList" AutoPostBack="true" OnSelectedIndexChanged="ReportSelected" runat="server" />
            <asp:Panel ID="pnlReports" runat="server" />
         </div>
    </FormTemplate>
</EditFormSettings>

protected void ReportSelected(object sender, EventArgs e)
{
    DropDownList ddl = (DropDownList)sender;

    if (ddl.SelectedIndex != 0)
    {
        GridEditFormItem editItem = (GridEditFormItem)ddl.NamingContainer;
        Panel pnlReports = (Panel)editItem.FindControl("pnlReports");
        pnlReports.Controls.Clear();

        SavedReport saved = new SavedReport(int.Parse(ddl.SelectedValue));
        Control cntrl = Page.LoadControl("/controls/" + saved.ControlPath);                  
     }
}

Thank you in advanced.

Lucky Pierre
  • 570
  • 4
  • 18
  • I had "ClientIDMode="Static" on the main RadGrid. Removing that from the tag seems to get rid of this error being thrown, but what would that have anything to do with things? – Lucky Pierre Apr 19 '13 at 14:28
  • This was a known issue, I believe it's been fixed in the latest version of the Telerik tools. – msigman May 08 '13 at 16:10
  • 1
    Just had this happen to me today, so I guess it's not fixed after all. –  Jun 23 '14 at 11:02
  • Did you try setting ClientIDMode="predictable" on the control? That's what solved it for me. I've noticed Telerik tools and a static ClientIDMode do not mix very well. – Lucky Pierre Jun 23 '14 at 12:04

1 Answers1

0

Figured I'd post this answer partially based on your comment. I had ClientIDMode="Static" set on my GridTemplateColumn

<telerik:GridTemplateColumn>
    <ItemTemplate>
        <telerik:RadButton OnClientClicked="windowShow" ClientIDMode="Static" Text="Example" runat="server">
        </telerik:RadButton>
    </ItemTemplate>
</telerik:GridTemplateColumn>

The OP seemed to get the error from having ClientIDMode="Static" set on the main RadGrid tag. I guess we should all just stay away from mixing this property with Telerik. I spent a half day, all over Google, before I finally found this post.

KidBilly
  • 3,408
  • 1
  • 26
  • 40