的OnClick的OnClientClick [英] OnClientClick OnClick
问题描述
在我的ASP页面,我把客户端的桌面截图与小程序,并要求他们将其与的LinkButton
的一个单一的点击发送给服务器。我使用 runApplet()
函数来调用我的小程序来捕捉屏幕和字符串值赋给一个隐藏的价值。 (图片存储为Base64字符串)到这里,一切都运行完美!然而,SendLinkButton_Click似乎没有被执行!
In my asp page, I take a screenshot of the client's desktop with an applet and ask them to send it to the server with a single click of a LinkButton
. I use runApplet()
function to call my applet to capture the screen and assign the strings value to a hidden value. (picture is stored as base64 string) Until here, everything works perfect! However, SendLinkButton_Click doesnt seem to be executing!
这是我的链接按钮。</ STRONG>
This is my link button.
<asp:LinkButton ID="SendLinkButton"
OnClientClick="runApplet(); return false;"
OnClick="SendLinkButton_Click"
Visible="false"
CssClass="portal-arrow portal-button"
runat="server">Send</asp:LinkButton>
这是我的Javascript函数
function runApplet() {
var msg = document.capture.capture();
var hiddenControl = '<%= inpHide.ClientID %>';
document.getElementById(hiddenControl).value = msg;
}
这是什么SendLinkButton_Click里面
protected void SendLinkButton_Click(object sender, EventArgs e)
{
Server.Transfer("Preview.aspx", true);
}
当我把JavaScript函数来一个LinkButton的的OnClientClick,并执行这个SendLinkButton_Click与其他的LinkButton。它完美的作品!但我希望他们只需点击一下鼠标工作!
when I put the javascript function to a LinkButton's OnClientClick, and execute this "SendLinkButton_Click" with another LinkButton. It works perfect! But I want them to work with just one click!
请帮帮忙!
推荐答案
您的客户端点击是返回false,所以没有回发会到服务器这点后作出的。
Your client click is returning false so no postback will be made to the server after this point.
尝试改变:
OnClientClick="runApplet(); return false;"
要
OnClientClick="runApplet();"
这篇关于的OnClick的OnClientClick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!