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

Set Tooltip for Template Item

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Javad Davari
Top achievements
Rank 1
Javad Davari asked on 27 Sep 2008, 12:32 PM
Hello

i can add a tooltip for each GridDataItem in RadGrid1_ItemDataBound
event
Cs
 if (e.Item is GridDataItem)  
        {  
            GridDataItem gridItem = e.Item as GridDataItem;  
            gridItem["PriceTest"].ToolTip = String.Format("{0:n0}", Convert.ToDouble(gridItem["SumAggregation"].Text));  

now
can i add a tooltip for each item in a TemplateItem in this Event

Thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Sep 2008, 05:08 AM
Hello Javad,

I guess you are trying to set the tooltip for a control in the ItemTemplate for a GridTemplateColumn. If so you can try out the following code snippet in the ItemCreated event of RadGrid.


ASPX:
   <telerik:GridTemplateColumn HeaderText="TemplateColumn" UniqueName="TemplateColumn"
                      <ItemTemplate> 
                          <asp:LinkButton ID="LinkButton1" Text="Click" runat="server"></asp:LinkButton> 
                      </ItemTemplate> 
                    </telerik:GridTemplateColumn> 

CS:
  protected void RadGrid2_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            LinkButton lnkbtn = (LinkButton)item["TemplateColumn"].FindControl("LinkButton1"); 
            lnkbtn.ToolTip = "MyCustomToolTip"
        } 
    } 

Thanks
Shinu.

Tags
Grid
Asked by
Javad Davari
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or