带有从数据库检索的选项的对话框

Sca*_*car 5 c# database asp.net telerik drop-down-menu

我有一个数据库表Prospect,用于存储具有主键ID和版本的潜在客户.Generate Proposalwebform中有一个radbutton ,点击后会显示一个对话框,允许用户从下拉框中选择要生成的潜在客户版本.我有一个方法,将从数据库中检索潜在客户的版本,GetVersions()但不知道如何将其放在一个对话框中,以允许用户选择版本.任何帮助是极大的赞赏.

LjC*_*ode 2

JQuery UI 是一个选择吗?

您必须添加 JQuery UI 参考,可以在此处找到

这是有关 JQuery UI 对话框的文档。

下面的代码取自我实现的解决方案。为了简单起见,我删除了相当多的代码。如果您需要任何说明,请告诉我。

HTML:

<div id="MenuChangeSelection" title="Change Selection" class="MainDialog">
    <div id="MenuChangeSelectionContent"></div>
 </div>
Run Code Online (Sandbox Code Playgroud)

jQuery:

        $("#YourRadBtnID").click(function () {
            var yourDropDownMarkup = "<select><option value='Opt1'>Opt1</option></select>"; // Insert your dropdown markup or get your dropdown from the dom.
            $("#MenuChangeSelectionContent").html(yourDropDownMarkup);
            $("#MenuChangeSelection").dialog({
                autoOpen: true,
                modal: true,
                width: 600,
                height: 150,
                buttons: {
                    "Save And Close": function() {
                        //Do something when Save And Close is clicked. eg. asynchronously post back to server.
                    },
                    "Cancel": function() {
                        $(this).dialog("close");
                    }
                },
                open: function () {
                    $('.ui-widget-overlay').addClass('custom-overlay');
                },
                close: function () {
                    $('.ui-widget-overlay').removeClass('custom-overlay');
                }
            });
        });
Run Code Online (Sandbox Code Playgroud)

CSS:

    .ui-widget-overlay.custom-overlay
    {
        background-color:black;
        opacity:0.4;
        filter:alpha(opacity=40); /* For IE8 and earlier */
    }
Run Code Online (Sandbox Code Playgroud)