.net的小程序 不知道为什么不能执行 求指点
<%@ Page Language="C#" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>webform</title>
</head>
<body>
<asp:label runat="server" id="Label1" text="请输入您的姓名" width="148px"></asp:label>
<form id="tbName" runat="server"></form>
<asp:button id="btHello" runat="server" text="问候一下" Width="80px" ></asp:button>
</body>
</html>
private void btHello_Click(object sender, System.EventArgs e)
{
string str;
StringBuilder StrScript= new StringBuilder();
StrScript.Append("<script type="javascript">" );
if (zhis.t.Text!=null)
{
str=this.tbName.Text.Trim()+"你好!";
}
else
{
str="姓名不能为空!";
}
StrScript.Append("alert('"+str+"');");
StrScript.Append("</script>");
RegisterStartupScript("MessageBox",StrScript.ToString());
}
}
}
[解决办法]
private void btHello_Click这些c#代码你也写道脚本一起了?.aspx和.cs是分开的
[解决办法]