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

ClientSettings and Child Grids in a WebUserControl Edit Form

1 Answer 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 11 Oct 2011, 06:17 AM
Hello,

I'm having a problem with ClientEvents on a RadGrid being applied to all child grids contained within the parent grid.  I have a grid configured like this:

<telerik:RadGrid ID="myGrid" runat="server"
    AllowSorting="true" AutoGenerateColumns="false"
    AllowPaging="true" PageSize="50" Height="500">
     
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn Visible="false" DataField="Id" UniqueName="Id" />
            <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" UniqueName="FirstName" />
            <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" UniqueName="Last Name" />
        </Columns>
        <EditFormSettings EditFormType="WebUserControl" UserControlName="~/EditForm.ascx" />
 
         
    </MasterTableView>
     
     <ClientSettings EnableRowHoverStyle="true">
        <Scrolling UseStaticHeaders="True" AllowScroll="True" />
        <ClientEvents OnRowDblClick="editRow" />
    </ClientSettings>
</telerik:RadGrid>

The editRow function is as follows:

function editRow(sender, eventArgs) {
    sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
}

The grid functions beautifully and the edit form loads and submits successfully.  However, there is a secondary grid in the edit form (EditForm.ascx) which seems to be inheriting the ClientSettings from the parent grid, such that if you double click one of the rows inside the user control then editRow fires and the item being edited is changed (because get_itemIndexHierarchical returns the index of the item double clicked inside EditForm.ascx).

I've looked at the events and documentation, but do not see a way to clear the client settings on the child grids.  I can probably work around it by using a button for editing instead of the double click event, but the client specifically requested the double click.  Does anyone have an idea on how I can clear the client settings on the grid within the EditForm.ascx user control?  I really want to get rid of both the event handler and the hover style from the grids within EditForm.ascx.

Thanks in advance for any help!

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 13 Oct 2011, 07:54 AM
Hello Andrew,

I don't believe that the grid in the edit form is inheriting the settings from the parent grid - what actually happens is that the double click event bubbles up to the parent grid and edit row client-side event is fired. Therefore, just the opposite, you should attach an event handler to the second grid's OnRowDblClick event and prevent the bubbling along with returning false from the handler as well.

Hope it helps.

All the best, Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or