This is a migrated thread and some comments may be shown as answers.

RadGrid AllowScroll property causes error

1 Answer 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 21 Feb 2012, 03:23 PM
When I dynamically instantiate a RadGrid server side and insert it into a placeholder control I have no problems.  If I create the same RadGrid with identical properties declaratively, I get the error: "Error: Sys.InvalidOperationException: A control is already associated with the element.".  If I remove the AllowScroll property from the declarative RadGrid, the error goes away, but this isn't what I'm looking for.  Since I will be reusing the same grid over several pages I created a user control that wraps the RadGrid, but I am still getting the error.  Leaving out AllowScroll removes the error but, again, this isn't what I need.  I tried adding the AllowScroll property in the pre-render event, but I get the same error.  I can't figure out how the same grid created dynamically works when creating it declaratively doesn't. 

Here's the dynamic version (c#):
            RadGrid grid = new RadGrid();
            grid.ID = "GridName";
            grid.Skin = SkinName;
            grid.CssClass = "gridCss";
            grid.AllowMultiRowSelection = true;
            grid.MasterTableView.HeaderStyle.Wrap = false;
            grid.MasterTableView.HeaderStyle.Height = Unit.Pixel(50);
            grid.MasterTableView.AutoGenerateColumns = true;
            grid.ClientSettings.Scrolling.AllowScroll = true;
            grid.ClientSettings.Scrolling.UseStaticHeaders = true;
            grid.ClientSettings.Selecting.AllowRowSelect = true;
            grid.ClientSettings.AllowKeyboardNavigation = true;

and here's the declarative version:
<telerik:RadGrid runat="server" ID="GridName" AllowMultiRowSelection="true" Skin="SkinName">
    <ClientSettings AllowKeyboardNavigation="true" KeyboardNavigationSettings-AllowSubmitOnEnter="false">
        <Selecting AllowRowSelect="true" />
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    </ClientSettings>
    <MasterTableView HeaderStyle-Wrap="true" HeaderStyle-Height="50px"> 
    </MasterTableView>
</telerik:RadGrid>



1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Feb 2012, 05:28 AM
Hello,

I couldn't replicate the issue.Check the following Demo.
Grid / Scrolling

-Shinu.
Tags
Grid
Asked by
Sean
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or