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

[Solved] Add Markup from derived RadGrid

3 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 15 May 2013, 09:22 PM
I need to inherit from RadGrid and add some markup when it renders - specifically I want to add a header bar (not headers as in columns, headers as in a chunk of markup that renders across the top of the control that contains some hyperlinks for some commands related to the displayed grid contents as a whole). I want to do it through inheritance so that I can have the developers on my team easily add my derived control to dozens of pages that all need the same things hooked up so I can encapsulate it in the derived control class.

How would I go about adding some markup to the rendered markup from the derived control class? For my specific use case I want to add the markup to the stream just before RadGrid starts rendering its content. 

Conceptually, I want to turn something like this:
<div><asp:Hyperlink OnClicked="SomeHandlerInPageCodeBehindWithSameCodeOnEveryPage"/></div>
<telerik:RadGrid>...</telerik:RadGrid>

into:
<my:RadGridEx>...</my:RadGridEx>

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 20 May 2013, 12:52 PM
Hi Brian,

Please note that custom created controls are not supported even if they are inherited directly from RadControls. Therefore, you will need to review your specific implementation logic. If you decide to continue with your idea, I am afraid the case will be out-of-scope for our support team.

Please elaborate on exactly you want to achieve and send us some screenshots or video demonstrating the requested behavior. Thus, we will be able to figure out your exact scenario and suggest a proper approach.

All the best,
Eyup
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.
0
Brian
Top achievements
Rank 1
answered on 20 May 2013, 10:53 PM
I have a user control I am stacking on top of the RadGrid in a div like so:
        <div>
            <uc1:ColumnPickerControl runat="server" ID="ColumnPickerControl" RadGridID="CustomersGrid" />
            <telerik:RadGrid ID="CustomersGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" AllowSorting="true" ...>
            ...</telerik:RadGrid>
</div>
The UserControl contains a hyperlink, and a panel targeted by an AJAX Control Toolkit ModalPopupExtension to pop up a UI for a column picker. It has some script associated with it that is targeting the RadGrid client API to hide and show columns based on a list of CheckBox selections in the popup dialog (which is dynamically populated after data binding the grid in the server code). Basically I want to get that user control and its associated script "encapsulated" in some way in the derived control so that the developers just have to drop my derived control on the pages instead of having to add the two controls.

Thanks
Brian
0
Eyup
Telerik team
answered on 24 May 2013, 10:55 AM
Hi Brian,

Have you tried using a UserControl  to achieve the requested functionality by including the HyperLink
and the grid in the ascx file?

Regards,
Eyup
Telerik
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
Brian
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Brian
Top achievements
Rank 1
Share this question
or