1

我的aspx页面上有一个隐藏的div(使用display:none css)。当用户单击按钮时,会出现一个灯箱,上面有一个下拉列表。当他们选择某些东西时,它不会触发 selectedindexchanged 事件。

出于测试目的,当我将样式设置为 display:block 并选择弹出窗口(灯箱)之外的下拉列表时,它工作得很好

http://www.jacklmoore.com/colorbox/

<asp:DropDownList ID="ddlPlan" AppendDataBoundItems="true" AutoPostBack="True" runat="server" OnSelectedIndexChanged="ddlPlan_SelectedIndexChanged" EnableViewState="True"

该控件未绑定回发,我正在使用 Page.IsPostBack 和其他页面加载。

谢谢!

 <a class="meds" style="padding:0;" href="#"><img border="0" src="Images/Medications.jpg" alt="" style="margin-left:4px;margin-top:1px;"/></a>
<div id="medications" style="display:none;background-color:#EFEEEF;padding-left:15px;">
        <div style="width:100%;height:106px;background-image:url('Images/warning-bg.jpg');background-repeat:repeat-x;">
        <img src="Images/checkoutItems.jpg" />
    </div>
<div style="padding-left:15px;">
    <p>Select a plan in the dropdown list below, and you will see suggested visit items for the package. If the patient isn't using a package for this visit, then check "Charge Item", and the totals will be calculated.</p>
    <div><asp:Label ID="Label" runat="server" Text="Select Plan " Font-Bold="true"></asp:Label><asp:DropDownList ID="ddlPlan" AppendDataBoundItems="true" AutoPostBack="True" runat="server" OnSelectedIndexChanged="ddlPlan_SelectedIndexChanged" EnableViewState="True">
                    <asp:ListItem> </asp:ListItem>
                </asp:DropDownList>
</div>
</div>

在我的脑海中:

 $(document).ready(function () {
                    $("a.meds").colorbox({
                    width: "50%", height: "84%", inline: true, href: function () {
                        // var elementID = $(this).attr('id');
                        return "#medications";
                    }, onOpen: function () { $('#medications').show(); }, onCleanup: function () { $('#medications').hide(); }

                }); 
      });

页面加载背后的代码:

if (!Page.IsPostBack)
            {

                ddlPlan.Items.Clear();
                ddlPlan.DataSource = Database.GetAllPlans();
                ddlPlan.DataBind();
                ddlPlan.Items.Insert(0, " ");
}

selectedindex 后面的代码已更改:

protected void ddlPlan_SelectedIndexChanged(object sender, EventArgs e)
{
    if (ddlPlan.SelectedIndex == 0)
    {
        txtTotal.Text = "";
        txtNetTotal.Text = "";
        ClearAll();
        return;
    }
4

0 回答 0