/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/usercontrols/multiselect.ascx
143 строки
4 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="multiselect.ascx.vb" Inherits="UserControls_multiselect" %> <style> .dropdown dd, .dropdown dt { margin: 0px; padding: 0px; } .dropdown ul { margin: -1px 0 0 0; } .dropdown dd { position: relative; } .anchor { display: block; cursor: pointer; padding: 1px 1px 1px 1px; min-height: 14px; min-width: 123px; line-height: 10px; overflow: hidden; border: 0.5px Solid Gray; } .dropdown dt a span, .multiSel span { cursor: pointer; display: inline-block; padding: 0 3px 2px 0; } .dropdown dd ul { background-color: White; border: 0; color: #000; display: none; left: 0px; padding: 2px 15px 2px 5px; position: absolute; top: 2px; min-width: 123px; width: auto; list-style: none; height: 75px; overflow: auto; border: 1px solid Gray; text-align: left; } .dropdown span.value { display: none; } .dropdown dd ul li a { padding: 5px; display: block; } .stripe { background-color: #fff; } </style> <dl class="dropdown" runat="server" id="selectContainer"> <dt> <asp:Label ID="lblCaption" runat="server" Text="" CssClass ="anchor"></asp:Label> </dt> <dd> <div class="multiSelect" runat ="server"> <asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate> <ul> <li> <asp:CheckBox ID="chkAll" runat="server" Text="ALL" fieldvalue ="ALL" checktype="ALL" Checked ="<%# allChecked %>" /> </li> </HeaderTemplate> <ItemTemplate> <li> <asp:CheckBox ID="chkListItem" runat="server" Checked ="True" Text="<%# DataBinder.Eval(Container.DataItem, _textField) %>" fieldValue="<%# DataBinder.Eval(Container.DataItem, _valueField) %>" /> </li> </ItemTemplate> <FooterTemplate> </ul> </FooterTemplate> </asp:Repeater> </div> </dd> </dl> <asp:HiddenField ID="hfCheckedItems" runat="server"/> <asp:HiddenField ID="hfFieldName" runat="server"/> <script> /* Dropdown with Multiple checkbox select with jQuery - May 27, 2013 (c) 2013 @ElmahdiMahmoud license: http://www.opensource.org/licenses/mit-license.php */ $("<%= "#" + lblCaption.ClientID%> ").on("click", function () { $("<%= "#" + selectContainer.ClientID + " dd ul" %>").slideToggle('fast'); }); $(".dropdown dd ul li a").on('click', function () { $(".dropdown dd ul").hide(); }); $(document).bind('click', function (e) { var $clicked = $(e.target); if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide(); }); $('<%= "#" + selectContainer.ClientID %> input[type="checkbox"]').on('click', function () { if ($(this).closest('span').attr('checktype') != undefined) { var checked = $(this).is(':checked'); $('<%= "#" + selectContainer.ClientID %> input[type="checkbox"]').each(function () { $(this).prop("checked", checked); }) } else { $('<%= "#" + selectContainer.ClientID %> span[checktype="ALL"]').children().prop("checked",false); } var itemsState = '{'; $('<%= "#" + selectContainer.ClientID %> input[type="checkbox"]').each(function () { if (itemsState != '{') { itemsState = itemsState + ',' } itemsState = itemsState + '\'' + $(this).closest('span').attr('fieldvalue') + '\':' + $(this).prop("checked") }) itemsState = itemsState + '}' <%--$("<%= "#" + hfCheckedItems.ClientID %>").val(itemsState);--%> saveMultiselectStat(<%= "'" + hfFieldName.Value + "'" %>, itemsState); }); </script>