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

RadTooltipManager not working with domain root, but does work with /default.aspx

5 Answers 106 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 01 Sep 2011, 10:53 AM
Hi

I've been playing with the demo's and really like the AJAX kit so will be buying it once I get paid for my current job, but whilst using the trial version I have come across an error with the RadTooltipManager and would appreciate some help if anyone is able to please.

Basically it works fine everywhere on the site, apart from the home page, but to make it more confusing it doesn't work when loaded via http://www.domain.com/ but it does work when I add default.aspx so http://www.domain.com/default.aspx

The error I get is:

RadToolTipManager response error:
Exception=Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405


I've also attached a screenshot of the error.

My code is:

default.aspx

<%@ Page Title="" Language="VB" MasterPageFile="~/main.master" AutoEventWireup="true" CodeFile="default.aspx.vb" Inherits="_default3" EnableEventValidation="false" ViewStateEncryptionMode="Never" validaterequest="false" enableviewstatemac="false" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Src="~/ProductDetails.ascx" TagName="ProductDetails" TagPrefix="uc1" %>
 
<asp:content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<meta name="keywords" content="keys" id="keywords" runat="server" />
<meta name="description" content="description" id="description" runat="server" />
<link rel="stylesheet" type="text/css" href="/skins/MyCustomSkin/ToolTip.MyCustomSkin.css" />
</asp:content>
<asp:content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <script type="text/javascript">
    var combo = null;
    function CloseActiveToolTip() {
        var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
        if (tooltip) tooltip.hide();
    }
    function OnClientHide(sender, args) {
        if (combo) {
            $find(combo.id).hideDropDown();
        }
    }
</script>
<telerik:radscriptmanager ID="RadScriptManager1" runat="server">
</telerik:radscriptmanager>
<telerik:radtooltipmanager runat="server" ID="RadToolTipManager1" Position="Center"
    RelativeTo="Element" Width="545px" Height="320px" Animation="Fade" HideEvent="LeaveTargetAndToolTip"
    OnAjaxUpdate="OnAjaxUpdate" OnClientHide="OnClientHide"
    EnableShadow="true" EnableEmbeddedSkins="false" Skin="Transparent"
    RenderInPageRoot="true" AnimationDuration="300"
    enableajaxskinrendering="True" autoclosedelay="60000">
</telerik:radtooltipmanager>
<asp:datalist id="dlProducts" runat="server" repeatcolumns="3" repeatdirection="Horizontal" repeatlayout="Table" cssclass="productlist" cellpadding="0" cellspacing="0" gridlines="None" borderstyle="None" datakeyfield="ProductID">
    <itemtemplate><div id="smallImage" class="productlistitems" runat="server"><%# BoxDetails(Container.DataItem)%></div></itemtemplate>
</asp:datalist>
<asp:label id="lblText" runat="server" />
</asp:content>

default.aspx.vb

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.IO
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI
 
Partial Class _default3
    Inherits System.Web.UI.Page
 
    Public Function BoxDetails(ByVal DataItem As Object) As String
        Dim MyConnection As SqlConnection
        MyConnection = New SqlConnection()
        MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
 
        Dim myTxt As String = ""
        If DataItem("TypeID").Equals(1) Then
            If Not DataItem("title").Trim().Equals("") Then
                myTxt = "<a class=""basic"" href=""" & DataItem("url").Trim() & """><img src=""/images/home/tn/" & DataItem("filename").Trim() & """ alt=""" & DataItem("title").Trim() & """ title=""" & DataItem("title").Trim() & """ /></a><div class=""productlisttitles""><a href=""" & DataItem("url").Trim() & """>" & DataItem("title").Trim() & "</a></div>"
            Else
                myTxt = "<a class=""basic"" href=""" & DataItem("url").Trim() & """><img src=""/images/home/tn/" & DataItem("filename").Trim() & """ alt=""" & DataItem("title").Trim() & """ title=""" & DataItem("title").Trim() & """ /></a>"
            End If
        End If
        If DataItem("TypeID").Equals(2) Then
            Dim strID As Integer = DataItem("ProductID")
            Dim sql As String = "SELECT ProductID, ProductName, price, url, " _
                & "(SELECT ImageFileName FROM ProductImages WHERE ProductID = Products.ProductID AND tn = 1) As Img1 " _
                & "FROM Products WHERE ProductID = @id"
 
            Dim objDR As SqlDataReader
            Dim CmdR As New SqlCommand(sql, MyConnection)
            With CmdR.Parameters
                .Add(New SqlParameter("@id", strID))
            End With
 
            MyConnection.Open()
            objDR = CmdR.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
            While objDR.Read()
                myTxt = "<a class=""basic"" href=""/product/" & objDR("url").Trim() & """><img src=""/images/products/mid/" & objDR("img1").Trim() & """ alt=""" & objDR("ProductName").Trim() & """ class=""noborder"" /></a><div class=""productlisttitles""><a class=""basic"" href=""/product/" & objDR("url").Trim() & """>" & objDR("ProductName").Trim() & "</a><br />£" & Decimal.Round(CDec(objDR("Price")), 2) & "</div>"
            End While
            MyConnection.Close()
        End If
        If DataItem("TypeID").Equals(3) Then
            myTxt = "<div class=""text255items"">" & DataItem("text").Trim() & "</div>"
            'myTxt = DataItem("text").Trim()
        End If
        Return myTxt
    End Function
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RadToolTipManager1.TargetControls.Clear()
        'RadToolTipManager1.UpdatePanel.ClientIDMode = System.Web.UI.ClientIDMode.AutoID
        If Not Page.IsPostBack Then
            BindData()
        End If
    End Sub
 
    Private Sub BindData()
        Dim body As HtmlGenericControl = DirectCast(Page.Master.FindControl("bodyTag"), HtmlGenericControl)
        body.Attributes.Add("class", "Home")
 
        Dim MyConnection As SqlConnection
        MyConnection = New SqlConnection()
        MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
 
        Dim sql As String = "SELECT * FROM CONTENT_PAGES WHERE PageID = 1"
 
        Dim objDR As SqlDataReader
        Dim CmdR As New SqlCommand(sql, MyConnection)
        MyConnection.Open()
        objDR = CmdR.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
        While objDR.Read()
            Page.Title = Replace(objDR("PageTitleTag").Trim(), "&", "and")
            keywords.Attributes("content") = Replace(objDR("PageKeywords").Trim(), "&", "and")
            description.Attributes("content") = Replace(objDR("PageDesc").Trim(), "&", "and")
            'lblTitle.Text = Replace(objDR("PageTitle").Trim(), "&", "and")
            Dim strText As String = objDR("PageText").Trim()
            If strText.StartsWith("<p>") Then
                lblText.Text = "</span>" & objDR("PageText").Trim() & "<span>"
            Else
                lblText.Text = "</span><p>" & objDR("PageText").Trim() & "</p><span>"
            End If
        End While
        MyConnection.Close()
 
        Dim sql3 As String = "SELECT * FROM HOME_SELECTIONS"
 
        Dim resultsDataSet3 As New DataSet()
        Dim myDataAdapter3 As SqlDataAdapter = New SqlDataAdapter(sql3, MyConnection)
        myDataAdapter3.Fill(resultsDataSet3, "title_meta")
        dlProducts.DataSource = resultsDataSet3
        dlProducts.DataBind()
    End Sub
 
    Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs)
        Me.UpdateToolTip(args.Value, args.UpdatePanel)
    End Sub
 
    Private Sub UpdateToolTip(ByVal elementID As String, ByVal panel As UpdatePanel)
        Dim ctrl As Control = Page.LoadControl("~/ProductDetails.ascx")
        panel.ContentTemplateContainer.Controls.Add(ctrl)
        Dim details As ProductDetails = DirectCast(ctrl, ProductDetails)
        details.ProductID = elementID
    End Sub
 
    Protected Sub ListBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        dlProducts.DataBind()
    End Sub
 
    Protected Sub dlProducts_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlProducts.ItemDataBound
        Dim image As Control = e.Item.FindControl("smallImage")
        Dim currentRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
        'Add the image id to the tooltip manager
        If Not currentRow.Row("ProductID").ToString() = 0 Then
            Me.RadToolTipManager1.TargetControls.Add(image.ClientID, currentRow.Row("ProductID").ToString(), True)
        End If
    End Sub
End Class

I've just re-downloaded and re-installed the trial, to make sure it wasn't something to do with that.

Many thanks in advance.

Rich

5 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 03 Sep 2011, 12:12 PM
Hi Richard,

I cannot see anything wrong with the provided code (related to the actual controls, I cannot say anything about the database calls). The error you are receiving is a generic one and is usually related to cross-domain scripting and security. I would suggest that you start, for example, from the following google search: http://www.google.com/search?q=ajax+error+405.

You can also try loading the user control dynamically in a regular update panel and see if the issue persists, as it may be something related to the way you get the data - a webservice or a method from the user control may not be working properly.

You can also try examining the domain of the page (document.domain) for both cases - when it works and when it doesn't. If, for example, in one of the cases you get www.domain and in the other just domain this would be a viable reason for such an error.

In the end, if you cannot determine where this issue originates I would advise that you stick with the configuration that works.


Greetings,
Marin
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Richard
Top achievements
Rank 1
answered on 03 Sep 2011, 08:23 PM
Thanks for the advice, appreciate it.

It seems that there's something ajax not working, as I'm finding that the onitemcommand for datagrids in standard updatepanels aren't working either, unless I call them using /default.aspx.

No idea what yet though.

Rich
0
Marin Bratanov
Telerik team
answered on 06 Sep 2011, 08:42 AM
Hi Richard,

It would seem that your machine/project is not configured properly to use AJAX.  I hope the following articles will help you in troubleshooting this issue:
http://www.telerik.com/help/aspnet-ajax/introduction-general-aspnetajax-info.html
http://www.telerik.com/help/aspnet-ajax/introduction-adding-radcontrols-prometheus-existing-application.html

What I would advise is that you uninstall the MS AJAX framework, restart your machine, install it again, restart again and see if the issue persists. You can also try creating a RadControlsWebSite instead of the regular WebSite in VS as it has the needed handlers.

There is also another possibility for AJAX issues - we have found that the AjaxControlToolkit assembly, when present in the site's Bin directory (it does not even need to be reference anywhere) overrides some of the default MS AJAX scripts, so if you have it you can also try deleting it to see if this helps.

Kind regards,
Marin
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Richard
Top achievements
Rank 1
answered on 06 Sep 2011, 10:42 AM
Thanks Marin, I was pretty sure I'm all setup fine, but I checked anyway and it appears I am.  Tried a new RadControls site as you suggested too.

Just tried using Fiddler2 and it appears the 405 is basically the below:

The HTTP verb POST used to access path '/' is not allowed.

I am using IIS6 and have wildcard mapping setup for URL rewriting purposes, so I wonder if this is part of the problem, although I don't see why it should be.  Do you know if there is a way I can set the post to /default.aspx instead of /? 

I've tried the below and different variations with / and ~/ in the Page_Load of my default.aspx.vb:

Page.Form.Action = "default.aspx"

But it didn't work :(

Rich
0
Richard
Top achievements
Rank 1
answered on 06 Sep 2011, 11:11 PM
Just thought I'd let you all know I found a solution, I just added the following to my URL Rewriting rules:

<rewrite url="^(.*)/(\?.+)?$" to="$1/default.aspx$2" />

Rich
Tags
ToolTip
Asked by
Richard
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Richard
Top achievements
Rank 1
Share this question
or