0

I've got a .net website, c# codebehind. I've got a LinkButton control which, when clicked, I want to fire off some code on the backend. However I'm also triggering a modal pop confirmation to show up on the front end by clicking on the button. The modal pop fires, but its suppressing ever firing off the code on the backend. Can someone lend me a hand on figuring out what's going on?

front:

<asp:LinkButton ID="lbWishlist" runat="server" rel="#wishlist" CssClass="modalInput" onclick="lbWishlist_Click"><img src="images/products_add_wishlist.jpg" border="0" /></asp:LinkButton>

<div class="modal" id="wishlist">
<h2>Succesfully added!</h2>
This item has been successfully added to your wishlist.
<br /><br />
<button type="button" class="close" style="width:70px;height:20px;border:1px solid #a2a2a2;color:#333333;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:9px;"> Close </button>
</div>

Codebehind:

 protected void lbWishlist_Click(object sender, EventArgs e)
        {
            //some code
        }

modal script:

  <script type="text/javascript">
        var triggers = $(".modalInput").overlay({

            // some mask tweaks suitable for modal dialogs
            mask: {
                color: '#ebecff',
                loadSpeed: 200,
                opacity: 0.9
            },

            closeOnClick: false
        });
</script>
4

1 回答 1

1

那不应该是您需要将链接按钮绑定到的单击事件吗?在这种情况下,您将在叠加层上显示对话框。按钮永远不会被点击。所以服务器事件几乎不会被触发。

因此,如果您已经对出现的模态对话框感到满意,则在确认对话框上单击“是”后,您可以使用以下代码触发服务器事件。

$(".modalInput").trigger("click");
于 2013-08-07T03:08:58.070 回答