Hi,
I have created a dynamic tooltip for a radcombobox with checkboxes. As items in the combobox are checked or unchecked I change the tooltip for the combobox to the items that are selected. I have been able to get this to work successfully using the following code.
My problem becomes when I try to put in a new line in the tooltip text to separate the selected items.
I changed the tooltip expression to
I have created a dynamic tooltip for a radcombobox with checkboxes. As items in the combobox are checked or unchecked I change the tooltip for the combobox to the items that are selected. I have been able to get this to work successfully using the following code.
Private Sub rcbCompany_ItemChecked(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles rcbCompany.ItemChecked
prpSelectedCount = Me.rcbCompany.GetCheckedIndices.Count
Dim strToolTipField = IIf(prpDisplayType = "Name", e.Item.Text, e.Item.Value.ToString)
If e.Item.Checked = True Then
'If an item has been checked, add the company number to the prpSelectedValue list and the company code/name to the prpToolTip list.
prpSelectedValue = prpSelectedValue + "," + e.Item.Attributes("CompanyNumber")
prpToolTip = prpToolTip + strToolTipField
Else
'If no companies are check set prpSelectedValue and the prpToolTip to Nothing,
If prpSelectedCount = 0 Then
prpSelectedValue = ""
prpToolTip = ""
Else
'otherwise remove the unchecked company from the prpSelectedValue property
prpSelectedValue = prpSelectedValue.Replace("," + e.Item.Attributes("CompanyNumber"), "")
prpToolTip = prpToolTip.Replace(";" + strToolTipField, "")
End If
End If
'Remove the extra comma, if any at the beginning of the string
If prpSelectedValue.StartsWith(",") = True Then
prpSelectedValue = prpSelectedValue.Remove(0, 1)
End If
If prpToolTip.StartsWith(";") = True Then
prpToolTip = prpToolTip.Remove(0, 1)
End If
Me.rcbCompany.ToolTip = prpToolTip
rttManagerCompany.TargetControls.Clear()
rttManagerCompany.TargetControls.Add(Me.rcbCompany.ClientID, True)
RaiseEvent OnItemCheckedCompanyHandler(sender, e)
End Sub
Private Sub rttManagerCompany_AjaxUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.ToolTipUpdateEventArgs) Handles rttManagerCompany.AjaxUpdate
Dim lblToolTip As New Label()
lblToolTip.Text = prpToolTip
e.UpdatePanel.ContentTemplateContainer.Controls.Add(lblToolTip)
End Sub
My problem becomes when I try to put in a new line in the tooltip text to separate the selected items.
I changed the tooltip expression to
prpToolTip = prpToolTip + "<br/>" + strToolTipField.
After I added the new line character(<br/>) I get the following error.
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
As a test to see if it was my generated tooltip that was causing the problem, I changed the lblToolTip.Text in the rttManagerCompany_AjaxUpdate to "line1 <br/> line2" and I still get the error. If I remove the <br/> I do not get an error and the tooltip displays as line1line2.
Can anyone tell me how to get a new line in the tooltip.
Thank you for your help.
Tracy
After I add the new line