popupControl displayed at a wrong place

Last post 02-12-2008 12:51 PM by iamtgo3. 10 replies.

Sort Posts:

  • popupControl displayed at a wrong place

    12-10-2006, 5:30 PM
    • Loading...
    • Michael Z.
    • Joined on 10-30-2006, 2:56 PM
    • Posts 5
    I have a DataList working with Popup Control, when I click the items in the datalist, the corresponding popup Control shows up. it works fine when there are very limited number of records in the datalist and there is no scroll bar( vertical scroll bar in my case), but if the records get increased and scroll bar appears, after I scroll  down to the bottom or somewhere, the popup window now will moved to the north by a certain distance instead of showing up at where I click, the distance seems to be proportional to how far I scrolled down, any one experienced similar situation? thanks
  • Re: popupControl displayed at a wrong place

    12-11-2006, 2:12 AM
    • Loading...
    • kirtid
    • Joined on 11-18-2006, 12:41 AM
    • Redmond
    • Posts 658
    • AspNetTeam
    Could you post the code that is exposing this behaviour?
    Kirti Deshpande
    Program Manager, Silverlight and ASP.NET AJAX
    Microsoft

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: popupControl displayed at a wrong place

    12-11-2006, 4:32 PM
    • Loading...
    • Michael Z.
    • Joined on 10-30-2006, 2:56 PM
    • Posts 5

    thanks for your response 

    ......

    <

    asp:DataList ID="SimilarSongDataList" runat="server" CellPadding="0" CellSpacing="0" BorderWidth="0" OnItemCreated="SimilarSongDataList_ItemCreated" OnItemDataBound="SimilarSongDataList_ItemDataBound">
    <ItemStyle CssClass = "grid_row" />
    <AlternatingItemStyle CssClass = "grid_row_alt" />
    <ItemTemplate>
    <td class="grid_nums"><span class="grid_pound">#</span><asp:Label runat="server" ID="lblSimilarSongSerialNo"></asp:Label></td>
    <td class="grid_song">

    <asp:HyperLink ID="songName" runat="server" Text='<%# Eval("Name") %>'></asp:HyperLink>

    </td>

    <td class="grid_btns">

     

    <asp:HyperLink runat="server" ID="lnkPlaySong" NavigateUrl='<%# Eval("Url") %>' >

    <img src="/Bell.Sympatico.CMS/Images/inDiscover/btn_play.gif" alt="play" width="18" height="19" border="0" />

    </asp:HyperLink>

     

    <asp:HyperLink runat="server" ID="lnkAddToPlayList">

    <img src="/Bell.Sympatico.CMS/Images/inDiscover/btn_playlist.gif" alt="Add To Playlist" width="18" height="19" border="0" />

    </asp:HyperLink>

    <ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" TargetControlID="lnkAddToPlayList" PopupControlID="Panel1" Position="Bottom" />

    </td>

    </ItemTemplate>

    <AlternatingItemTemplate>

    <td class="grid_nums"><span class="grid_pound">#</span><asp:Label runat="server" ID="lblSimilarSongSerialNo"></asp:Label></td>

    <td class="grid_song_alt">

    <asp:HyperLink ID="songName" runat="server" Text='<%# Eval("Name") %>'></asp:HyperLink>

    </td>

    <td class="grid_btns_alt">

     

    <asp:HyperLink runat="server" ID="lnkPlaySong" NavigateUrl='<%# Eval("Url") %>' >

    <img src="/Bell.Sympatico.CMS/Images/inDiscover/btn_play.gif" alt="play" width="18" height="19" border="0" />

    </asp:HyperLink>

     

    <asp:HyperLink runat="server" ID="lnkAddToPlayList">

    <img src="/Bell.Sympatico.CMS/Images/inDiscover/btn_playlist.gif" alt="Add To Playlist" width="18" height="19" border="0" />

    </asp:HyperLink>

    <ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" TargetControlID="lnkAddToPlayList" PopupControlID="Panel1" Position="Bottom" />

    </td>

    </AlternatingItemTemplate>

    </asp:DataList>
    ......

    <div id="Panel1" runat="server" class="popup_table">

    <uc2:AddToPlaylist id="addToPlaylist2" runat="server"></uc2:AddToPlaylist>

    </div>

    ---- I put the popup control in a user control, the code of uc2 is like following:

    <%

    @ Register Assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="Microsoft.Web.UI" TagPrefix="asp" %>

    <%

    @ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

    <

    div style="Z-INDEX:999;" class="popup_container">

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

    <ContentTemplate>

    <table border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td colspan="2" class="popup_title"><asp:Label ID="pnl1Title" runat="server" Text=""></asp:Label>

    <asp:TextBox id="hidSongID" style="width:1px;visibility:hidden;" runat="server"></asp:TextBox>

    </td>

    </tr>

    <tr>

    <td class="popup_dropdown">

    <asp:DropDownList ID="ddlPlaylist" runat="server" ></asp:DropDownList>

    </td>

    <td class="popup_submitbtn"><asp:Button ID="btnAddToPlaylist" runat="server" Text="Add to Playlist" OnClick="btnAddToPlaylist_Click" /></td>

    </tr>

    </table>

    </ContentTemplate>

    </asp:UpdatePanel>

    </

    div>
  • Re: popupControl displayed at a wrong place

    01-04-2007, 11:37 AM
    • Loading...
    • nackler
    • Joined on 01-03-2007, 6:25 AM
    • Posts 3
    I'm experiencing this behavior as well
  • Re: popupControl displayed at a wrong place

    01-04-2007, 10:21 PM
    • Loading...
    • eperez
    • Joined on 01-05-2007, 3:00 AM
    • Posts 1

    Yes, I am getting the same effect. I was really confused because the toolkit sample works great, but did not work well at all on my page.

    My page does have a scrollbar and that is the only thing I could think of. Hopefully, this will be fixed soon. I was really looking forward to using a calendar using this popup control.

     

    Thanks.

  • Re: popupControl displayed at a wrong place

    01-06-2007, 12:34 PM
    • Loading...
    • rsvl
    • Joined on 11-10-2006, 6:00 AM
    • Posts 24
    I was having these same issues with the popup control as well. I finally gave up and figured the pop up control needs A LOT of work before it is usable. I ended up using the animation extender to have a div fade and and fade out. There's a javascript function in the sample site that aligns your div with the control that is displaying your "pop up".
  • Re: popupControl displayed at a wrong place

    01-06-2007, 1:31 PM
    • Loading...
    • MathiasR
    • Joined on 01-02-2007, 11:13 AM
    • Paderborn, Germany
    • Posts 4
    Do you have a DOCTYPE declaration on your page? I had the same problem before I put a DOCTYPE on my page, because IE6/7 render the page in quirks mode without the doctype.
    Filed under: , , ,
  • Re: popupControl displayed at a wrong place

    01-30-2007, 6:05 PM
    • Loading...
    • ottobar
    • Joined on 01-30-2007, 10:51 PM
    • Posts 1

    I believe that the problem lies in that the popup control does not take into account a scroll offset.  I agree with some of the comments that this library needs some work, but that is why we are here on the bleeding edge...to help make it better.

     Here is what I did to fix:

    1. Add this function to AjaxControlToolkit\Common\Common.js (I added it after getClientBounds)

     getClientScrollOffset : function() {
            /// <summary>
            /// Gets how much the page has scrolled.
            /// </summary>
            /// <returns type="Array">
            /// Scrolled x and y values for the browser window.
            /// </returns>

            var x,y;
            if (window['pageYOffset'] != undefined) // all except Explorer
            {
                x = window.pageXOffset;
                y = window.pageYOffset;
            }
            else if (document.documentElement && document.documentElement['scrollTop'] != undefined)
            // Explorer 6 Strict
            {
                x = document.documentElement.scrollLeft;
                y = document.documentElement.scrollTop;
            }
            else if (document.body) // all other Explorers
            {
                x = document.body.scrollLeft;
                y = document.body.scrollTop;
            }
            return [x, y];
        },

     2. Modify a section of the show function in AjaxControlToolkit\PopupControl\PopupControlBehavior.js (specifically, I added the "var scrollOffsetX"... line and modified the "if (newPosition.x + newPosition.width"... section)
     

    ...

            var documentWidth = self.innerWidth ? self.innerWidth : document.documentElement.clientWidth;
            var scrollOffsetX = CommonToolkitScripts.getClientScrollOffset()[0];
            // CONSIDER: Create a generic function to return this information.
            if (!documentWidth) {
                documentWidth = document.body.clientWidth;
            }
            if (newPosition.x + newPosition.width > (documentWidth + scrollOffsetX - 5)) {
                position.x -= newPosition.x + newPosition.width - documentWidth - scrollOffsetX + 5;
                updateNeeded = true;
            }
            if (newPosition.x < 0) {
                position.x -= newPosition.x;
                updateNeeded = true;
            }
            if (newPosition.y < 0) {
                position.y -= newPosition.y;
                updateNeeded = true;
            }

    ... 

    This seems to work for me, but please provide feedback.

  • Re: popupControl displayed at a wrong place

    02-07-2007, 2:07 AM
    • Loading...
    • SplendidCRM
    • Joined on 08-11-2006, 6:29 PM
    • Posts 1

    I had two problems with the fix.  One was that it did not account for a vertical scroll, and the other was that my browser returned (0, 0) for documentElement.scrollLeft and documentElement.scrollTop.  My fix was to adjust the position before setLocation is called.  I also wanted to limit my fix to a single file so that I can re-apply the fix easlily.

     if (window['pageYOffset'] != undefined) // all except Explorer
    {
        position.x += window.pageXOffset;
        position.y += window.pageYOffset;
    }
    else if (document.body) // all other Explorers
    {
        position.x += document.body.scrollLeft;
        position.y += document.body.scrollTop;
    }
    CommonToolkitScripts.setLocation(elt, position);

  • Re: popupControl displayed at a wrong place

    04-02-2007, 2:35 AM
    • Loading...
    • lintan
    • Joined on 04-02-2007, 6:30 AM
    • Borås, Sweden
    • Posts 1
    SplendidCRM:

    I had two problems with the fix.  One was that it did not account for a vertical scroll, and the other was that my browser returned (0, 0) for documentElement.scrollLeft and documentElement.scrollTop.  My fix was to adjust the position before setLocation is called.  I also wanted to limit my fix to a single file so that I can re-apply the fix easlily.

     if (window['pageYOffset'] != undefined) // all except Explorer
    {
        position.x += window.pageXOffset;
        position.y += window.pageYOffset;
    }
    else if (document.body) // all other Explorers
    {
        position.x += document.body.scrollLeft;
        position.y += document.body.scrollTop;
    }
    CommonToolkitScripts.setLocation(elt, position);

     

    I had the exact same problem, but i experienced problems mainly in ie 6. After trying your fix i got problems in mozilla as well, so what i did was to remove the first if and add a third (or a second one) and then it worked in both ff, ie6 and most others that i tested.

     

    Here is how:

     

    if (document.body) // all other Explorers
    {
        position.x += document.body.scrollLeft;
        position.y += document.body.scrollTop;
    }
    else if (document.documentElement)
    {
        //IE6 standards compliant mode
        position.y += document.documentElement.scrollTop;
        position.x += document.documentElement.scrollLeft;
    }
     
  • Re: popupControl displayed at a wrong place

    02-12-2008, 12:51 PM
    • Loading...
    • iamtgo3
    • Joined on 05-22-2006, 4:37 PM
    • Posts 20

    SplendidCRM and lintan

    I get the code you have both posted but can you show me an example of how you incorporated it into the common.js file to make it work. My popups are fine as well till you scroll then it is anyone guys where they come up. I would like to add more Ajax things to my pages but I am stopped by working as designed not as desired issues.

    George - (iamtgo3) www.ipdg3.com
    (AS / CADD / CompTIA A+ Certified / CompTIA Network+ Certified / MCSA / MCP / MCT)
    Helping Developers and Programmers Find Resources
Page 1 of 1 (11 items)