views:

148

answers:

1

Right now I have a RadToolTip inside of a RadGrid. The RadGrid displays a field from the datasource called "Value". The RadToolTip displays the same thing.

I want to add another RadGrid inside of the RadToolTip. The function setting up the datasource of that second RadGrid should take "Value" as a parameter?

How do I do that?

Here's what I have so far.

<h2>Currently Assigned Tags</h2>

<telerik:RadGrid runat="server" ID="grdTags" OnNeedDataSource="grdTags_NeedDataSource" AllowMultiRowSelection="true"
    AutoGenerateColumns="false" OnDeleteCommand="DeleteTag" Skin="CiscoGreen" EnableEmbeddedSkins="false">
    <ClientSettings>
        <Selecting AllowRowSelect="true" />
    </ClientSettings>
    <MasterTableView DataKeyNames="KeywordID">

        <Columns>

            <telerik:GridButtonColumn ButtonType="LinkButton" Text="Delete" CommandName="Delete" />
            <telerik:GridBoundColumn Visible="false" DataField="KeywordID" />
            <telerik:GridBoundColumn HeaderText="Value" DataField="Value" />

            <telerik:GridTemplateColumn UniqueName="ToolTip">
                <HeaderTemplate>
                    Related Campaigns
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label runat="server" ID="TargetLabel" Text='<%# DataBinder.Eval(Container.DataItem, "Value") %>' />
                    <telerik:RadToolTip ID="ttRelatedCampaigns" runat="server" Width="300px" Height="300px" TargetControlID="TargetLabel">
                        <%# DataBinder.Eval(Container.DataItem, "Value") %>
                        <telerik:RadGrid ID="grdRelatedCampaigns" runat="server" OnNeedDataSource='<%# DataBinder.Eval(Container.DataItem, "Value") %>' AutoGenerateColumns="false"
                            Skin="CiscoGreen" EnableEmbeddedSkins="false">
                            <MasterTableView DataKeyNames="InitiativeName">
                                <Columns>
                                    <telerik:GridBoundColumn HeaderText="Campaign Name" DataField="Value" />
                                </Columns>
                            </MasterTableView>    
                        </telerik:RadGrid>
                    </telerik:RadToolTip>
                </ItemTemplate>
            </telerik:GridTemplateColumn>

        </Columns>

    </MasterTableView>                
</telerik:RadGrid>
A: 

This syntax is not appropriate for the inner grid's NeedDataSource handler unless you want the name of the handler to match the Value property value:

OnNeedDataSource='<%# DataBinder.Eval(Container.DataItem, "Value") %>'

Instead inside the nested grid NeedDataSource handler in the code-behind you can reference the Value with the same syntax:

string val = DataBinder.Eval(Container.DataItem, "Value").ToString();

and then filter the source based on the given value.

Dick Lampard
Hmm, I'm not sure that I understand your answer. But I'll give it a try... Thank you!
Joshua Moore
The DataBinder object doesn't seem to be available in code-behind. Eval exists, but intellisense doesn't recognize Container. Is there another way to get to the data, perhaps through an eventarg?
Joshua Moore
Sorry, my bad, it should actually be: string val = DataBinder.Eval(e.Item.DataItem, "Value").ToString();
Dick Lampard