Ramakrishna Thadivaka
Top achievements
Rank 1
Ramakrishna Thadivaka
asked on 29 Jan 2010, 04:50 PM
Hi There,
I am unble to get tooltip for ImageButton which will be enabled false in some scenarious in those scenarious tooltip for ImageButton is not visible
can any one help me out reply me soon.
Thanks in advance.
T.Ramakrishna.
3 Answers, 1 is accepted
0
Hi Ramakrishna,
Would you please share some relevant code along with more detailed explanations? Once I receive this, I will built up a test setup, examine it and do my best to help.
Kind regards,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Would you please share some relevant code along with more detailed explanations? Once I receive this, I will built up a test setup, examine it and do my best to help.
Kind regards,
Svetlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ramakrishna Thadivaka
Top achievements
Rank 1
answered on 02 Feb 2010, 04:48 AM
Thanks for the reply,
Here i am sending the code, here is the source code of the grid and TooltipManager in this i am having four image buttons at last in the grid
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> |
<Triggers> |
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> |
</Triggers> |
<ContentTemplate> |
<telerik:RadGrid ID="gviewTasks" runat="server" |
AllowPaging="True" AllowScroll="True" AllowSorting="True" GridLines="None" |
AutoGenerateColumns="False" Skin="Vista" |
EnableLinqExpressions="False" |
Font-Bold="False" Font-Italic="False" Font-Overline="False" |
Font-Underline="False" PageSize="7" |
onitemcommand="gviewTasks_ItemCommand" |
onitemdatabound="gviewTasks_ItemDataBound" |
onitemcreated="gviewTasks_ItemCreated" onpageindexchanged="gviewTasks_PageIndexChanged"> |
<MasterTableView Font-Size="Small" TableLayout="Fixed" > |
<columns> |
<telerik:GridBoundColumn DataField="TaskID" HeaderText="ID" Visible="false" /> |
<telerik:GridBoundColumn DataField="Resource Name" HeaderText="Resource Name" |
HeaderStyle-Width="70px" > |
<HeaderStyle Width="70px" /> |
</telerik:GridBoundColumn> |
<telerik:GridTemplateColumn HeaderText="Task Name" AllowFiltering="false" Groupable="false" HeaderStyle-Width="50px" > |
<ItemTemplate> |
<asp:LinkButton ID="lnkTask" runat="server" CommandName="select" Text='<%#DataBinder.Eval(Container.DataItem,"Task Name")%>'></asp:LinkButton> |
</ItemTemplate> |
<HeaderStyle Width="50px" /> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="Task Name" HeaderText="TaskName" /> |
<telerik:GridBoundColumn DataField="Description" HeaderText="TaskDescription" |
HeaderStyle-Width="70px" AllowFiltering="false" Groupable="false" > |
<HeaderStyle Width="80px" /> |
</telerik:GridBoundColumn> |
<telerik:GridTemplateColumn HeaderText="Phase" HeaderStyle-Width="50px" AllowFiltering="false" Groupable="false"> |
<ItemTemplate> |
<asp:Label ID="lblphase" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Phase") %>'></asp:Label> |
|
</ItemTemplate> |
<HeaderStyle Width="50px" /> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="Project Name" HeaderText="Project" |
HeaderStyle-Width="50px" > |
<HeaderStyle Width="50px" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="AssignedBy" HeaderText="Assigned By" |
HeaderStyle-Width="75px" > |
<HeaderStyle Width="75px" /> |
</telerik:GridBoundColumn> |
<telerik:GridNumericColumn DataField="Estimated Hours" HeaderText="ETA [Hrs]" |
HeaderStyle-Width="60px" > |
<HeaderStyle Width="50px" /> |
</telerik:GridNumericColumn> |
<telerik:GridBoundColumn DataField="Date" HeaderText="Date" HeaderStyle-Width="75px" > |
<HeaderStyle Width="75px" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="Status" HeaderText="Status" HeaderStyle-Width="75px" > |
<HeaderStyle Width="75px" /> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="Approve Status" HeaderText="Approval Status" |
HeaderStyle-Width="75px" > |
<HeaderStyle Width="75px" /> |
</telerik:GridBoundColumn> |
<telerik:GridTemplateColumn HeaderText="Approve" AllowFiltering="false" Groupable="false" HeaderStyle-Width="40px" UniqueName="Approve" > |
<ItemTemplate> |
<asp:ImageButton ID="imgbtnactivate" runat="server" ImageUrl="~/images/activate.gif" CommandName="Approve" ToolTip="Approve" OnClientClick="return confirm('Are you sure you want to approve this task?');"></asp:ImageButton> |
</ItemTemplate> |
<HeaderStyle Width="40px" /> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Reject" AllowFiltering="false" Groupable="false" HeaderStyle-Width="30px" UniqueName="Reject" > |
<ItemTemplate> |
<asp:ImageButton ID="imgbtndeactivate" runat="server" CausesValidation="false" ImageUrl="~/images/de-activate.gif" CommandName="Reject" ToolTip="Reject" OnClientClick="return confirm('Are you sure you want to reject this task?');"></asp:ImageButton> |
</ItemTemplate> |
<HeaderStyle Width="30px" /> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn HeaderText="Forward" AllowFiltering="false" Groupable="false" HeaderStyle-Width="40px" UniqueName="Forward" > |
<ItemTemplate> |
<asp:ImageButton ID="imgforward" runat="server" ImageUrl="~/images/forward.gif" CausesValidation="false" CommandName="Select1" ToolTip="Forward" OnClick="forwardLeave"></asp:ImageButton> |
</ItemTemplate> |
<HeaderStyle Width="40px" /> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="ResourceID" Visible="false"/> |
<telerik:GridTemplateColumn HeaderText="Delete" AllowFiltering="false" Groupable="false" HeaderStyle-Width="30px" UniqueName="Delete" > |
<ItemTemplate> |
<asp:ImageButton ID="imgdelete" runat="server" ImageUrl="~/images/delete-icon.gif" CommandName="deleteTask" ToolTip="Delete" OnClientClick="return confirm('Are you sure you want to delete the task?');"></asp:ImageButton> |
</ItemTemplate> |
<HeaderStyle Width="30px" /> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="DocumentID" HeaderText="DocID" Visible="false" ></telerik:GridBoundColumn> |
</columns> |
<PagerStyle Height="30px" HorizontalAlign="Center" Font-Bold="True" |
Font-Names="Arial" Font-Size="Smaller" /> |
<HeaderStyle BorderStyle="None" Font-Bold="True" |
Height="30px" /> |
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="Blue" /> |
</MasterTableView> |
<ClientSettings EnableRowHoverStyle="true"> |
<Selecting AllowRowSelect="true" /> |
<Scrolling EnableVirtualScrollPaging="True" UseStaticHeaders="True" /> |
<Resizing AllowColumnResize="True" /> |
</ClientSettings> |
<PagerStyle Mode="NumericPages" /> |
</telerik:RadGrid> |
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" |
AutoTooltipify="True" Width="30px" BackColor="#FFCCFF" BorderStyle="Solid" |
BorderWidth="30px"> |
</telerik:RadToolTipManager> |
</ContentTemplate> |
</asp:UpdatePanel> |
Here i am sending the C# code behind where i have return in ItemDataBound event of the gird where in some scenarious ImageButons will be enable false.
protected void gviewTasks_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
string strTxt1 = ""; |
int index; |
try |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem item = (GridDataItem)e.Item; |
// string strTxt = item["Approval Status"].Text.ToString(); |
strTxt1 = item["Approve Status"].Text.ToString(); |
} |
if (strTxt1 != "") |
{ |
ImageButton imgforward = new ImageButton(); |
imgforward = (ImageButton)e.Item.Cells[13].FindControl("imgforward"); |
if (e.Item.Cells[5].Text.ToString() == "Leave") |
{ |
e.Item.Cells[16].Attributes.Add("OnClick", "return AlertConfirmation();"); |
} |
LinkButton lnkbtntaskname = new LinkButton(); |
lnkbtntaskname = (LinkButton)(e.Item.Cells[4].FindControl("lnkTask")); |
if (e.Item.Cells[5].Text.ToString().Trim().ToLower() == "leave") |
{ |
lnkbtntaskname.ForeColor = System.Drawing.Color.Black; |
} |
else |
{ |
lnkbtntaskname.ForeColor = System.Drawing.Color.Blue; |
} |
if (Convert.ToInt16(e.Item.Cells[19].Text) != 0) |
{ |
lnkbtntaskname.ForeColor = System.Drawing.Color.Brown; |
} |
if (strTxt1.ToString().ToLower() == "approved") |
{ |
ImageButton activate = new ImageButton(); |
activate = (ImageButton)(e.Item.Cells[14].FindControl("imgbtnActivate")); |
activate.ImageUrl = "images/activate.gif"; |
activate.Enabled = false; |
//activate.ToolTip = "Approve"; |
ImageButton deactivate = new ImageButton(); |
deactivate = (ImageButton)(e.Item.Cells[15].FindControl("imgbtnDeActivate")); |
deactivate.ImageUrl = "images/for-approve.gif"; |
deactivate.Enabled = false; |
//deactivate.ToolTip = "Reject"; |
ImageButton forward = new ImageButton(); |
forward = (ImageButton)(e.Item.Cells[16].FindControl("imgforward")); |
forward.ImageUrl = "images/forward.gif"; |
forward.Enabled = true; |
ImageButton delete = new ImageButton(); |
delete = (ImageButton)(e.Item.Cells[18].FindControl("imgdelete")); |
delete.ImageUrl = "images/deactive-reject.gif"; |
delete.Enabled = false; |
//delete.ToolTip = "Delete"; |
} |
else if (strTxt1.ToString().ToLower() == "rejected") |
{ |
ImageButton activate = new ImageButton(); |
activate = (ImageButton)(e.Item.Cells[14].FindControl("imgbtnActivate")); |
activate.ImageUrl = "images/for-approve.gif"; |
activate.Enabled = false; |
//activate.ToolTip = "Approve"; |
ImageButton deactivate = new ImageButton(); |
deactivate = (ImageButton)(e.Item.Cells[15].FindControl("imgbtnDeActivate")); |
deactivate.ImageUrl = "images/de-activate.gif"; |
deactivate.Enabled = false; |
//deactivate.ToolTip = "Reject"; |
ImageButton forward = new ImageButton(); |
forward = (ImageButton)(e.Item.Cells[16].FindControl("imgforward")); |
forward.ImageUrl = "images/forward.gif"; |
forward.Enabled = true; |
ImageButton delete = new ImageButton(); |
delete = (ImageButton)(e.Item.Cells[18].FindControl("imgdelete")); |
delete.ImageUrl = "images/deactive-reject.gif"; |
//~/images/delete-icon.gif |
delete.Enabled = false; |
//delete.ToolTip = "Delete"; |
} |
else if (strTxt1.ToString().ToLower() == "pending") |
{ |
ImageButton activate = new ImageButton(); |
activate = (ImageButton)(e.Item.Cells[14].FindControl("imgbtnActivate")); |
activate.ImageUrl = "images/for-approve.gif"; |
ImageButton deactivate = new ImageButton(); |
deactivate = (ImageButton)(e.Item.Cells[15].FindControl("imgbtnDeActivate")); |
deactivate.ImageUrl = "images/for-approve.gif"; |
ImageButton forward = new ImageButton(); |
forward = (ImageButton)(e.Item.Cells[16].FindControl("imgforward")); |
forward.ImageUrl = "images/forward.gif"; |
} |
else if (strTxt1.ToString().ToLower() == "deleted") |
{ |
ImageButton activate = new ImageButton(); |
activate = (ImageButton)(e.Item.Cells[14].FindControl("imgbtnActivate")); |
activate.ImageUrl = "images/for-approve.gif"; |
//Session["activate"] = activate; |
activate.Enabled = false; |
// activate.ToolTip = "Approve"; |
ImageButton deactivate = new ImageButton(); |
deactivate = (ImageButton)(e.Item.Cells[15].FindControl("imgbtnDeActivate")); |
deactivate.ImageUrl = "images/for-approve.gif"; |
deactivate.Enabled = false; |
//deactivate.ToolTip = "Reject"; |
ImageButton forward = new ImageButton(); |
forward = (ImageButton)(e.Item.Cells[16].FindControl("imgforward")); |
forward.ImageUrl = "images/forward.gif"; |
//forward.Enabled = false; |
} |
string todaysdate1 = objTaskmanLib.getTodaysDate(); |
if (e.Item.Cells[12].Text.ToString().ToLower() != "inprocess" || e.Item.Cells[11].Text.ToString().Trim() != todaysdate1.Trim()) |
{ |
ImageButton delete = new ImageButton(); |
delete = (ImageButton)(e.Item.Cells[16].FindControl("imgdelete")); |
delete.ImageUrl = "images/deactive-reject.gif"; |
delete.Enabled = false; |
//delete.ToolTip = "Delete"; |
} |
ImageButton activate1 = new ImageButton(); |
activate1 = (ImageButton)(e.Item.Cells[14].FindControl("imgbtnActivate")); |
if (activate1.Enabled == false) |
{ |
activate1.Enabled = true; |
activate1.ToolTip = "Approve"; |
//activate1.Enabled = ; |
} |
} |
if (e.Item is GridDataItem) |
{ |
foreach (TableCell cell in e.Item.Cells) |
{ |
cellcell.ToolTip = cell.Text; |
} |
GridDataItem item2 = (GridDataItem)e.Item; |
LinkButton lnkbtn = (LinkButton)item2.FindControl("lnkTask"); |
lnkbtnlnkbtn.ToolTip = lnkbtn.Text; |
GridDataItem item3 = (GridDataItem)e.Item; |
Label lbl = (Label)item3.FindControl("lblphase"); |
lbllbl.ToolTip = lbl.Text; |
if (!e.Item.IsInEditMode) |
{ |
string cellText = (e.Item as GridDataItem)["Description"].Text; |
string Task_NamecellText = (e.Item as GridDataItem)["Task Name"].Text; |
string resourcecellText = (e.Item as GridDataItem)["Resource Name"].Text; |
string projectcellText = (e.Item as GridDataItem)["Project Name"].Text; |
string assignedbycellText = (e.Item as GridDataItem)["AssignedBy"].Text; |
//AssignedBy |
if (Convert.ToInt16(cellText.Length) > ((int)clsGeneric.gridtooltip.taskmaindescription)) |
{ |
(e.Item as GridDataItem)["Description"].Text = cellText.Substring(0, (int)clsGeneric.gridtooltip.taskmaindescription); |
string length = (e.Item as GridDataItem)["Description"].Text; |
if (Convert.ToInt16(length.Length) == (int)clsGeneric.gridtooltip.taskmaindescription) |
{ |
//string lengthlength1 = length + "......"; |
(e.Item as GridDataItem)["Description"].Text = length + "......"; |
//(e.Item as GridDataItem)["Description"].Text = length1; |
} |
} |
if (Convert.ToInt16(Task_NamecellText.Length) > ((int)clsGeneric.gridtooltip.taskmaindescription)) |
{ |
(e.Item as GridDataItem)["Task Name"].Text = Task_NamecellText.Substring(0, (int)clsGeneric.gridtooltip.taskmaindescription); |
string Task_Namelength = (e.Item as GridDataItem)["Task Name"].Text; |
if (Convert.ToInt16(Task_Namelength.Length) == (int)clsGeneric.gridtooltip.taskmaindescription) |
{ |
//string lengthlength1 = length + "......"; |
(e.Item as GridDataItem)["Task Name"].Text = Task_Namelength + "......"; |
//(e.Item as GridDataItem)["Description"].Text = length1; |
} |
} |
if (Convert.ToInt16(resourcecellText.Length) > ((int)clsGeneric.gridtooltip.taskmainresourcename)) |
{ |
(e.Item as GridDataItem)["Resource Name"].Text = resourcecellText.Substring(0, (int)clsGeneric.gridtooltip.taskmainresourcename); |
string resourcelength = (e.Item as GridDataItem)["Resource Name"].Text; |
if (Convert.ToInt16(resourcelength.Length) == (int)clsGeneric.gridtooltip.taskmainresourcename) |
{ |
//string length1 = resourcelength + "......"; |
(e.Item as GridDataItem)["Resource Name"].Text = resourcelength + "......"; |
//(e.Item as GridDataItem)["Resource Name"].Text = length1; |
} |
} |
if (Convert.ToInt16(projectcellText.Length) > ((int)clsGeneric.gridtooltip.taskmainprojectname)) |
{ |
(e.Item as GridDataItem)["Project Name"].Text = resourcecellText.Substring(0, (int)clsGeneric.gridtooltip.taskmainprojectname); |
string projectlength = (e.Item as GridDataItem)["Project Name"].Text; |
if (Convert.ToInt16(projectlength.Length) == (int)clsGeneric.gridtooltip.taskmainprojectname) |
{ |
(e.Item as GridDataItem)["Project Name"].Text = projectlength + "......"; |
} |
} |
if (Convert.ToInt16(assignedbycellText.Length) > ((int)clsGeneric.gridtooltip.assignedBy)) |
{ |
(e.Item as GridDataItem)["AssignedBy"].Text = resourcecellText.Substring(0, (int)clsGeneric.gridtooltip.assignedBy); |
string assignedbylength = (e.Item as GridDataItem)["AssignedBy"].Text; |
if (Convert.ToInt16(assignedbylength.Length) == (int)clsGeneric.gridtooltip.assignedBy) |
{ |
(e.Item as GridDataItem)["AssignedBy"].Text = assignedbylength + "......"; |
} |
} |
} |
} |
} |
catch (Exception ex) |
{ |
} |
} |
0
Hi Ramakrishna,
Thank you for the provided code, I was now able to understand what you mean. However, the behavior you report is expected because when you disable a control it does not throw its events and thus the tooltip does not "know" it should show. You can test this by using standard controls and without any RadControls at all. Take a look at the following code:
When the button is disabled the alert message is not thrown.
If you find a way to call the alert on hover of disabled button, share your solution here and we will make it work with RadToolTip as well.
Sincerely yours,
Svetlina
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Thank you for the provided code, I was now able to understand what you mean. However, the behavior you report is expected because when you disable a control it does not throw its events and thus the tooltip does not "know" it should show. You can test this by using standard controls and without any RadControls at all. Take a look at the following code:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
script
type
=
"text/C#"
runat
=
"server"
>
protected void OnClick(object sender, EventArgs e)
{
target.Enabled = !target.Enabled;
}
</
script
>
<
asp:Button
ID
=
"btn"
runat
=
"server"
Text
=
"Toggle Enabled"
OnClick
=
"OnClick"
/>
<
asp:ImageButton
ID
=
"target"
runat
=
"server"
ImageUrl
=
"~/ToolTipDemo/Sunset.jpg"
onmouseover
=
"alert('Button mouse over event fired!');"
/>
</
form
>
</
body
>
</
html
>
When the button is disabled the alert message is not thrown.
If you find a way to call the alert on hover of disabled button, share your solution here and we will make it work with RadToolTip as well.
Sincerely yours,
Svetlina
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.