且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我收到一个错误-不包含消息的定义.

更新时间:2023-02-20 11:26:58

您在OnClick事件中调用它
您需要在OnClientClick上调用它.
Your Calling it on OnClick event
you need to call that on OnClientClick.


正如mahen25所说,您需要在onclientclick事件中调用
As mahen25 said you need to call in onclientclick event
<asp:Button ID="Button1" runat="server" onclientclick="message()" Text="Button"/>


如果要调用函数服务器端,则需要在页面加载中注册Onclick事件.


You need to register the Onclick event in pageload if you want to call the function server side.

Button1.Attributes.Add("OnClick","message()");