Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 554225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:41:15+00:00 2026-05-13T11:41:15+00:00

I am using the ModalPopupExtender control to display a modal popup dialog when a

  • 0

I am using the ModalPopupExtender control to display a modal popup dialog when a button is click. The problem is that dragging the dialog results in an ‘scrollleft is null or not an object’ error.

Here’s a video demo

..and here is ALL the code:

If possible, I’d like to resolve this problem w/o resorting to modifying the AjaxToolkit scripts themselves.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MyModalSimple.aspx.vb" Inherits="MyModalSimple" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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>
    <style type="text/css">
        .modalBackground
        {
            background-color: Gray;
            filter: alpha(opacity=70);
            opacity: 0.7;
        }
    </style>
    <link href="Default.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">

        function onOk() {
            //form1.submit();
        }
    </script>

    <script type="text/javascript">
        var clientid;
        function fnSetFocus(txtClientId) {
            clientid = txtClientId;
            setTimeout("fnFocus()", 1000);

        }

        function fnFocus() {
            //debugger;
            if (document.getElementById("pnlModal").style.display != "none")
                eval("document.getElementById('" + clientid + "').focus()");
        }

        function fnClickOK(sender, e) {
            __doPostBack(sender, e);
        }


    </script>

</head>
<body>
    <form id="form1" runat="server">
        <br />
        Clicking the button will bring up the modal dialog<br />
        <br />    
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <cc1:ModalPopupExtender ID="Button1_ModalPopupExtender" runat="server" TargetControlID="Button1"
            PopupDragHandleControlID="programmaticPopupDragHandle" PopupControlID="pnlModal"
            OkControlID="btnOK" CancelControlID="btnCancel" DropShadow="true" OnOkScript="onOk();"
            BackgroundCssClass="modalBackground">
        </cc1:ModalPopupExtender>
        <br />
        <asp:Panel ID="pnlModal" runat="server" Style="display: None" BackColor="#CCCCCC">
            <asp:Panel runat="Server" ID="programmaticPopupDragHandle" Style="cursor: move; background-color: #DDDDDD;
                border: solid 1px Gray; color: Black; text-align: center;">
                Caption
            </asp:Panel>
            <br />
            <table>
                <tr>
                    <td>
                        <asp:Label ID="lblFirst" runat="server" Text="First"></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtFirst" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblLast" runat="server" Text="Last"></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtLast" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td align="right">
                        <asp:Button ID="btnOK" runat="server" Text="OK" />
                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <asp:Label ID="lblMessage" runat="server"></asp:Label>
        <br />
        <br />
        </div>
    </form>
</body>
</html>

Partial Class MyModalSimple

    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then

            Button1.Attributes.Add("onclick", "fnSetFocus('" + txtFirst.ClientID + "');")

            btnOK.OnClientClick = String.Format("fnClickOK('{0}','{1}')", btnOK.UniqueID, "")

        End If

    End Sub

    Protected Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Click
        lblMessage.Text = "Hi, " & txtFirst.Text & " " & txtLast.Text
    End Sub
End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:41:15+00:00Added an answer on May 13, 2026 at 11:41 am

    Unfortunately this is a known bug in the DragPanelExtender. I would recommend dropping the modal extender all together if it’s an option and you’re comfortable with javascript.

    With jQuery/jQuery UI for example, your page would look like:

    <form id="form1" runat="server">
      <br />
      Clicking the button will bring up the modal dialog<br />
      <br />    
      <div>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <br />
        <div id="myModal" Style="display: None" background="#CCCCCC" title="Caption/Dialog Title">
            <table>
                <tr>
                    <td>
                        <asp:Label ID="lblFirst" runat="server" Text="First" />
                    </td>
                    <td>
                        <asp:TextBox ID="txtFirst" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblLast" runat="server" Text="Last" />
                    </td>
                    <td>
                        <asp:TextBox ID="txtLast" runat="server" />
                    </td>
                </tr>
            </table>
        </div>
        <asp:Label ID="lblMessage" runat="server"></asp:Label>
        <br />
        <br />
        </div>
    </form>
    <script type="text/javascript">
      $(function() {
        $("#<%= Button1.ClientID %>").click() {
          $("#myModal").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });
        }
      });
    </script>
    

    This is a whole different way of programming, but results in a much richer UI experience for the user. If you’re willing to learn jQuery and how it hooks up, it’s a really natural/fluid syntax that can add a great deal of power/flexibility to your web pages. Now keep in mind that I prefer jQuery but that there are many other javascript libraries available. You should at least browse around and see what looks the most comfortable if you’re just getting started…it’s possible since you’re from a VB background (I’m from C#) that another libraries coding style/syntax is much more appealing.

    Now if you’re unwilling to go down that road and it’s too unfamiliar, your only alternative as far as I can see is to do what you don’t want to…compile the AJAX Control Toolkit yourself. If you want to go this route, grab the latest source from codeplex and modify the below section of Release\AjaxControlToolkit\Compat\DragDrop\DragDropScripts.js:

    _drag: function(isInitialDrag) {
      var ev = window._event;
      var mousePosition = { x: ev.clientX, y: ev.clientY };
    

    To this:

    _drag: function(isInitialDrag) {
      if (!this._activeDragVisual) return;
      var ev = window._event;
      var mousePosition = { x: ev.clientX, y: ev.clientY };
    

    The _onScrollerTick operation in certain browsers bombs out and nulls the dragVisual function. Credit is due here: A post on the ASP.Net forums by freakyer led me down this debug path to figure out where it’s breaking…but I see no other solution as there is an actual bug in certain browsers not-fixable without a script change and recompile.

    I urge you to consider the jQuery/other framework path, there’s a ton of community support and examples out there to help get you started. This question from a while back is worth a read if the framework options interest you at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 314k
  • Answers 314k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Right: when you decorate with a class, instead of with… May 13, 2026 at 11:02 pm
  • Editorial Team
    Editorial Team added an answer The .NET/VS settings framework already does exactly what you indicate… May 13, 2026 at 11:02 pm
  • Editorial Team
    Editorial Team added an answer it works (roughly) like how a dict works in python:… May 13, 2026 at 11:02 pm

Related Questions

I am using the ASP.NET AJAX Control Toolkit. Within this toolkit, I am only
I have an application that shows a list of items. The user can click
I am trying to use the following code to get a reference to a
I have Datalist that is inside an updatepanel and it is in panel in
I have an ASP.NET application that is using ASP.NET AJAX. I am using the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.