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

RadToolTip inside of RadGrid

3 Answers 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 13 Sep 2010, 11:16 PM
Hi,

I have a RadGrid, grdTags. It has a datasource with a field "Value"
Inside of grdTags, I have a ToolTip ttRelatedCampaigns. Right now it displays "Value"
Inside of ttRelatedCampaigns, I'd like to display another RadGrid. It's datasource should be set by a function that takes "Value" as a parameter.

Here's what I have so far. Could someone help me out and tell me how to do this?

<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>

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Sep 2010, 11:15 AM
Hello Joshua,

You cannot directly pass the value in OnNeedDataSource event. But you can try the following code in OnNeedDataSource event of the grid 'grdRelatedCampaigns' to set its DataSource based on the cell value in grid 'grdTags'.

C#:
protected void OnNeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
    RadGrid grdRelatedCampaigns = (RadGrid)source;
    foreach (GridDataItem item in grdTags.Items)
    {
        string value = item["Value"].Text;
        . . . . . . . .
        grdRelatedCampaigns.DataSource = // set grid's DataSource based on this 'Value'
    }
}

Thanks,
Princy.
0
Joshua
Top achievements
Rank 1
answered on 15 Sep 2010, 01:51 AM
Unfortunately, that didn't work. 

Cannot find a cell bound to column name 'Value'

is the error message I'm returned.
0
Princy
Top achievements
Rank 2
answered on 15 Sep 2010, 08:12 AM
Hello Joshua,

Since you did not set the UniqueName for the GridBoundColumn(for the DataField 'Value'), check whether the DataField name 'Value' match with the filed name in your table.

Thanks,
Princy.
Tags
Grid
Asked by
Joshua
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Joshua
Top achievements
Rank 1
Share this question
or