I'm trying to open popup window when i click on image button in asp.net website, but when i click on image button the pop up window shows up for like one seconds and then disappears.when i use tag, it shows the pop up window, but when i try with the other way, it disappears. Am i missing something in the code.
当我点击asp.net网站上的图像按钮时,我正在尝试打开弹出窗口,但是当我点击图像按钮时,弹出窗口显示为一秒钟然后消失。当我使用标签时,它显示弹出窗口向上窗口,但是当我用另一种方式尝试时,它会消失。我错过了代码中的内容。
<div id="cover"></div>
<div id="dialog">
My Dialog Content
<br><input type="text">
<br><input type="button" value="Submit">
<br><a href="#" onclick="closePopUp('dialog');">[Close]</a>
</div>
<a href="#" onclick="showPopUp('dialog');">Show</a>
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/slika/PLUS.gif" onClientClick="showPopUp('dialog');" />
1 个解决方案
#1
1
Clicking on ImageButton
causes postback - that reloads the page with no popup shown. This link describes a way to have an ImageButton
that does not cause form submision : Can I create an ASP.NET ImageButton that doesn't postback?
单击ImageButton会导致回发 - 重新加载页面而不显示弹出窗口。此链接描述了一种不会导致表单子模式的ImageButton的方法:我可以创建一个不回发的ASP.NET ImageButton吗?
onClientClick="showPopUp('dialog');return false;"
#1
1
Clicking on ImageButton
causes postback - that reloads the page with no popup shown. This link describes a way to have an ImageButton
that does not cause form submision : Can I create an ASP.NET ImageButton that doesn't postback?
单击ImageButton会导致回发 - 重新加载页面而不显示弹出窗口。此链接描述了一种不会导致表单子模式的ImageButton的方法:我可以创建一个不回发的ASP.NET ImageButton吗?
onClientClick="showPopUp('dialog');return false;"