2 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 06 Oct 2009, 06:04 AM
Hello Mario,
You could try the following code to set a tool tip for each row of grid.
CS:
JavaScript:
-Shinu.
You could try the following code to set a tool tip for each row of grid.
CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem dataItem1 = (GridDataItem)e.Item; |
dataItem1.Attributes.Add("onMouseOver", "return showToolTip('"+dataItem1.ClientID +"');"); |
} |
} |
JavaScript:
<script type="text/javascript"> |
function showToolTip(ID) |
{ |
var tooltip = $find("<%=RadToolTip1.ClientID %>"); |
tooltip.set_targetControlID(ID); |
} |
</script> |
-Shinu.
0
Mario
Top achievements
Rank 2
answered on 06 Oct 2009, 08:25 AM
hm yes maybe but i need to set the text of the tooltip dynamically in code behind of every tooltip for each row.
i tried the telerik online demo "tooltipified grid" way:
http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=grid
and created following DocumentInfo.ascx to show in the tooltip of the tooltipmanager:
I added the griditem as follows on the page where the grid is situated, like in the example so the tooltip show at the whole gridrow, which is working fine.
But when the tooltip shows up its empty.
When i debug my DocumentInfo.ascx its controls are empty in the PageLoad ... lblCreater = null
Not even the dsfdsfdf string inside the tabledata of the ascx is shown in the tooltip.
anyone knows why my ascx is empty?
thx, Mario
i tried the telerik online demo "tooltipified grid" way:
http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=grid
and created following DocumentInfo.ascx to show in the tooltip of the tooltipmanager:
using System; |
using System.Collections; |
using System.Configuration; |
using System.Data; |
using System.Linq; |
using System.Web; |
using System.Web.Security; |
using System.Web.UI; |
using System.Web.UI.HtmlControls; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Xml.Linq; |
using EDMS.Logic.BL; |
using EDMS.Logic.DAL; |
namespace EDMS.Web.Controls |
{ |
public partial class DocumentInfo : System.Web.UI.UserControl |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
if(!IsPostBack) |
BindTo(); |
} |
public string DocumentId { get; set; } |
private void BindTo() |
{ |
Document doc = BLDocument.GetDocument(Convert.ToInt32(DocumentId)); |
if (doc != null) |
{ |
if (doc.User != null) |
lblCreater2.Text = doc.User.firstname + " " + doc.User.lastname; |
else |
lblCreater1.Text = ""; |
} |
} |
} |
} |
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DocumentInfo.ascx.cs" Inherits="EDMS.Web.Controls.DocumentInfo" %> |
<table> |
<tr> |
<td>dsfdsfdf |
<asp:Label id="lblCreater1" runat="server" Text="Creater:"></asp:Label> |
</td> |
<td> |
<asp:Label id="lblCreater2" runat="server" Text=""></asp:Label> |
</td> |
</tr> |
</table> |
I added the griditem as follows on the page where the grid is situated, like in the example so the tooltip show at the whole gridrow, which is working fine.
protected void RadGridFavored_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) |
{ |
Control target = e.Item; |
if (!Object.Equals(target, null)) |
{ |
if (!Object.Equals(this.tipManager, null)) |
{ |
//Add the button (target) id to the tooltip manager |
this.tipManager.TargetControls.Add(target.ClientID, (e.Item as GridDataItem).GetDataKeyValue("id").ToString(), true); |
} |
} |
} |
} |
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args) |
{ |
this.UpdateToolTip(args.Value, args.UpdatePanel); |
} |
private void UpdateToolTip(string elementID, UpdatePanel panel) |
{ |
DocumentInfo info = new DocumentInfo(); |
info.DocumentId = elementID; |
panel.ContentTemplateContainer.Controls.Add(info); |
} |
But when the tooltip shows up its empty.
When i debug my DocumentInfo.ascx its controls are empty in the PageLoad ... lblCreater = null
Not even the dsfdsfdf string inside the tabledata of the ascx is shown in the tooltip.
anyone knows why my ascx is empty?
thx, Mario