Hi all:
I try to display the file ( txt, image , PDF , word..etc format) using tooltip. ( just like the sameple
http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultvb.aspx)
the issue is that when I mouse over the record, I got the following error : "RadTootipManager response error. ...the message received from server could not parsed..."
what I did is to read the files then use the response.write to generate the file content.please see code below:
on WidgetSupportDocument.ascx control:
Thanks
Helena
I try to display the file ( txt, image , PDF , word..etc format) using tooltip. ( just like the sameple
http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultvb.aspx)
the issue is that when I mouse over the record, I got the following error : "RadTootipManager response error. ...the message received from server could not parsed..."
what I did is to read the files then use the response.write to generate the file content.please see code below:
'on parent page which has tooltip with it Private Sub UpdateToolTip(ByVal elementID As String, ByVal panel As UpdatePanel) Dim ctrl As Control = Page.LoadControl("WidgetControls/WidgetSupportDocument.ascx") panel.ContentTemplateContainer.Controls.Add(ctrl) Dim details As WidgetSupportDocument = DirectCast(ctrl, WidgetSupportDocument) details.SupportDocumentID = elementID details.DisplayData() End Subon WidgetSupportDocument.ascx control:
Public Sub DisplayData() Dim dsData As DataSet Dim strFileName As String Dim byteData() As Byte Dim strDocumentType As String Dim arrSplit() As String 'load data from database dsData = LoadData(Me.SupportDocumentID) byteData = CType(dsData.Tables(0).Rows(0).Item("FileContent"), Byte()) arrSplit = Split(dsData.Tables(0).Rows(0).Item("Filename").ToString, ".") intLastValue = arrSplit.Length strDocumentType = arrSplit(intLastValue - 1) SetControlData(strDocumentType, byteData) End Sub Private Sub SetControlData(ByVal strDocumentType As String, ByVal byteView() As Byte, Optional ByVal strFileName As String = "") Dim strContentType As String = String.Empty Select Case UCase(strDocumentType) Case "HTML", "HTM" strContentType = "text/HTML" Case "BMP" strContentType = "image/BMP" Case "JPG" strContentType = "image/JPEG" Case "GIF" strContentType = "image/GIF" Case "PDF" strContentType = "application/pdf" Case "XLS" strContentType = "application/vnd.ms-excel" Case "DOC" strContentType = "application/msword" Case "TXT", "LOG" ' .txt file (such as a report tab delimited export) should open inline rather then directly in the browser If strFileName = "" Then strFileName = "ViewDocument.txt" End If With Response .ClearContent() .ClearHeaders() strContentType = "text/unknown" .AddHeader("Content-Length", CType(byteView.Length, String)) .AddHeader("Content-Disposition", "inline; filename=" & strFileName) End With Case Else End Select If strContentType.Length > 0 Then With Response .Clear() .ContentType = strContentType .BinaryWrite(byteView) .Flush() End With Else Response.Write("<font color='red'>The selected attachement cannot be displayed. </font>") End If End SubThanks
Helena