Control not responding to clicks

Apr 12, 2012 at 9:03 PM

When I try to use DropDownCheckboxList in my own web app, the control will not "pop up" when I click on it.  In comparing my setup to that of the demo project, everything seems the same, and the demo does not have this problem.

Any ideas as to where I'm going wrong?

Thanks

Eric

Apr 13, 2012 at 3:28 PM

Here is my markup...

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="MultiTest._Default" %>


<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <p>
        <asp:DropDownCheckBoxes ID="makeDropDownCheckBoxes" runat="server" OnSelectedIndexChanged="dcbHallucination_SelectedIndexChanged"
            AddJQueryReference="True" UseButtons="True" UseSelectAllNode="True">
            <Style SelectBoxWidth="160" DropDownBoxBoxWidth="160" DropDownBoxBoxHeight="115" />
            <Style2 SelectBoxWidth="160px" DropDownBoxBoxWidth="160px" DropDownBoxBoxHeight="115px">
            </Style2>
            <Texts SelectBoxCaption="Car make" />
            <Items>
                <asp:ListItem Text="Acura" Value="1" />
                <asp:ListItem Text="BMW" Value="2" />
                <asp:ListItem Text="Citroen" Value="3" />
                <asp:ListItem Text="Ford" Value="4" />
                <asp:ListItem Text="Jeep" Value="5" />
                <asp:ListItem Text="Kia" Value="6" />
                <asp:ListItem Text="Lancia" Value="7" />
                <asp:ListItem Text="Lexus" Value="8" />
                <asp:ListItem Text="Mazda" Value="8" />
                <asp:ListItem Text="Mercedes" Value="8" />
                <asp:ListItem Text="Mitsubishi" Value="8" />
                <asp:ListItem Text="Toyota" Value="8" />
            </Items>
        </asp:DropDownCheckBoxes>
    </p>
</asp:Content>

<!--Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MultiTest._Default"-->

Apr 18, 2012 at 6:59 PM

I've discovered what appears to be the source of the problem.  The "hitch" function contains a null value for the PageRequestManager.  How do I resolve this?

Thanks

Eric

(

function (a) { a.fn.hitch = function (d, c, b) { return this.bind(d, function () { return c.apply(b || this, Array.prototype.slice.call(arguments)); }); }; })(jQuery); function DropDownScript(g, e, f, c, b, a, d) { this.id = g; this.divPstfx = e; this.selectPstfx = f; this.postbackFunction = c; this.useButtons = b; this.autoPost = a; this.useSelectAll = d; this.divId = this.id + this.divPstfx; this.selId = this.id + this.selectPstfx; this.selection = new Array(); this.visible = false; this.preventHide = false; this.initialized = false; } DropDownScript.prototype.update = function (e, f, c, b, a, d) { this.divPstfx = e; this.selectPstfx = f; this.postbackFunction = c; this.useButtons = b; this.autoPost = a; this.useSelectAll = d; this.divId = this.id + this.divPstfx; this.selId = this.id + this.selectPstfx; this.initEvents(); }; DropDownScript.prototype.init = function () { var a = this; if (typeof Sys != "undefined") { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function (c, b) { a.initEvents(); }); } this.initEventHandlers(); this.initEvents(); this.initialized = true; }; DropDownScript.prototype.initEventHandlers = function () { this.documentClickHandler = function () { if (!this.preventHide && this.visible) { if (this.useButtons) { this.clickCancel(); } else { if (this.autoPost) { this.clickOk(); } else { this.hide(); } } } this.preventHide = false; }; this.divClickHandler = function (a) { a.stopPropagation(); }; this.selectBoxClickHandler = function (a) { if (this.visible) { this.hide(); } else { this.show(); this.preventHide = true; } }; this.selectAllClickHandler = function (a) { if (!this.useSelectAll) { return; } if (a.target.checked) { this.selectAll(); } else { this.deselectAll(); } }; this.checkBoxClickHandler = function (a) { this.updateSelectAll(); }; this.okClickHandler = function (a) { this.clickOk(); a.stopPropagation(); }; this.cancelHandler = function (a) { this.clickCancel(); a.stopPropagation(); }; }; DropDownScript.prototype.initEvents = function () { if (!this.initialized) { $(document).hitch("click", this.documentClickHandler, this); } var f = $("#" + this.divId); f.unbind("click.chk_dd"); f.hitch("click.chk_dd", this.divClickHandler, this); var c = $("#" + this.selId); c.unbind("click.chk_dd"); c.hitch("click.chk_dd", this.selectBoxClickHandler, this); var b = $("#" + this.divId + " input[type='checkbox']:first"); b.unbind("click.chk_dd"); if (this.useSelectAll) { b.hitch("click.chk_dd", this.selectAllClickHandler, this); } var a = this.getItems(); a.unbind("click.chk_dd"); a.hitch("click.chk_dd", this.checkBoxClickHandler, this); var e = $("#" + this.divId + " input[type='button']:first"); e.unbind("click.chk_dd"); e.hitch("click.chk_dd", this.okClickHandler, this); var d = $("#" + this.divId + " input[type='button']:gt(0)"); d.unbind("click.chk_dd"); d.hitch("click.chk_dd", this.cancelHandler, this); }; DropDownScript.prototype.clickOk = function () { this.hide(); this.saveSelection(); this.doPostBack(); }; DropDownScript.prototype.clickCancel = function () { this.hide(); this.restoreSelection(); }; DropDownScript.prototype.getItems = function () { return $("#" + this.id + " input[type='checkbox']"); }; DropDownScript.prototype.show = function () { $("#" + this.divId).show(); this.visible = true; this.saveSelection(); this.updateSelectAll(); }; DropDownScript.prototype.hide = function () { $("#" + this.divId).hide(); this.visible = false; }; DropDownScript.prototype.updateSelectAll = function () { if (!this.useSelectAll) { return; } var b = true; var a = this.getItems(); for (var c = 0; c < a.length; c++) { if (a[c].checked == false) { b = false; break; } } $("#" + this.divId + " input[type='checkbox']:first").attr("checked", b); }; DropDownScript.prototype.selectAll = function () { this.getItems().attr("checked", true); }; DropDownScript.prototype.deselectAll = function () { this.getItems().attr("checked", false); }; DropDownScript.prototype.saveSelection = function () { var a = this.getItems(); for (var b = 0; b < a.length; b++) { this.selection[b] = a[b].checked ? true : false; } }; DropDownScript.prototype.restoreSelection = function () { var a = this.getItems(); if (this.selection.length > 0) { for (var b = 0; b < a.length; b++) { a[b].checked = this.selection[b]; } } }; DropDownScript.prototype.doPostBack = function () { if (this.postbackFunction) { this

.postbackFunction.call(); } };

Apr 24, 2012 at 8:24 AM

I have the same problem.

Jul 4, 2012 at 8:25 PM

created with master page needed to use the code below:

 

        <div>           

<asp:ScriptManager ID="ScriptManager1" runat="server" />   

<script type="text/javascript" language="javascript">             

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);                Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);           

function BeginRequestHandler(sender, args)                {                }             

function EndRequestHandler(sender, args)                 {                }       

    </script>

                  </div>     

Dec 30, 2012 at 9:41 PM

Hi, I have the same problem, i use masterpage, I put this code in master and content page but not work, How can I do?, in other computer with vs2012 the sample of the project works fine.

Can I convert the 2010 sample project to 2008?

The error is :

Error en tiempo de ejecución de Microsoft JScript: El objeto no acepta la propiedad o el método 'hitch'

Thanks for all