asp图像按钮刷新页面
问题描述:
嗨我的网页有很多imageButtons,点击刷新页面。我如何防止这种情况?asp图像按钮刷新页面
var imageButton = new ImageButton();
imageButton.ImageUrl = "Styles/unClicked.png";
imageButton.ID = "btn" + questionName;
imageButton.OnClientClick = ("javascript:button_pressed()");
答
我的第一个答案是,如果您不希望图像后回,不使用<asp:ImageButton
>,只是使用<img>
元素。
但是,如果你想使用<asp:ImageButton>
然后更新以下行停止网页张贴回(刷新)...
imageButton.OnClientClick = "button_pressed();return false;"
注意,你不需要初始“的javascript: “(浏览器知道这是javascript)
现货上,欢呼声 – geminiCoder 2012-08-08 09:47:47
不客气@gemini,祝你好运,其余的项目:-) – freefaller 2012-08-08 09:52:07