asp.net的一个很简单的问题(10分)

  • 主题发起人 主题发起人 socket
  • 开始时间 开始时间
S

socket

Unregistered / Unconfirmed
GUEST, unregistred user!
以下是我的代码 myasp.aspx---文件名
<%@ Page Language="C#" %>
<HTML>
<HEAD>
<SCRIP runat=server>
protected void bit_ok_Click(object Source,EventArgs e)
{
label1.Text = "My Name is <b>FFF<b>" ;
}
</SCRIP>
</HEAD>
<BODY>
<H3>ASP.NET Example</H3>
<FORM runat=server>
<asp:Button id=bit_ok
runat=server
Text="OK"
onClik="bit_ok_Click" />
<br><br>
<asp:Label id=label1 runat=server />
</FORM>
</BODY>
</HTML>
在ie中输入http://localhost/webservice/myasp.aspx它输出为
protected void bit_ok_Click(object Source,EventArgs e) { label1.Text = "My Name is FFF" ;
}
ASP.NET Example
<<这里是一个按纽>>
为什么是这个结果,而书上说的结果是 "按了按纽以后它会在最下面显示 My Name is FFF "
 
我帮你改过了
你你输入错误
<%@ Page Language="C#" %>
<HTML>
<HEAD>
<script runat=server>
protected void bit_ok_Click(object Source,EventArgs e)
{
label1.Text = "My Name is <b>FFF<b>" ;
}
</script>
</HEAD>
<BODY>
<H3>ASP.NET Example</H3>
<FORM runat=server>
<asp:Button id=bit_ok
runat=server
Text="OK"
onClick="bit_ok_Click" />
<br><br>
<asp:Label id=label1 runat=server />
</FORM>
</BODY>
</HTML>
 
label1.Text = "My Name is &amp;lt;p&amp;gt;FFF&amp;lt;/p&amp;gt;" ;
 
下面修改是正确执行的:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<script runat="server">
void btn_click(object sender,EventArgs e)
{
message.Text="name: "+name.Text+" Category:"+Category.SelectedItem;
}
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312" />
<link href="intro.css" rel="stylesheet" />
</head>
<body>
<form action="intro4.aspx" method="post" runat="server">
<center>
</center>
<br />
<asp:textbox id="name" runat="server"></asp:textbox>
<asp:dropdownlist id="Category" runat="server">
<asp:listitem>psychology</asp:listitem>
<asp:listitem>business </asp:listitem>
<asp:listitem>kjjkljl</asp:listitem>
</asp:dropdownlist>
<asp:Button onclick="btn_click" runat="server" text="lookup"></asp:Button>
<br />
<asp:Label id="message" runat="server"></asp:Label>
</form>
</body>
</html>
 
多人接受答案了。
 
后退
顶部