我的.cs文件里有这些代码:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Collections;
public partial class _Default : System.Web.UI.Page,IPostBackEventHandler
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submit_Click(object sender, EventArgs e)
{
ltmain.Text = "<a href=\"" + Page.GetPostBackEventReference(this, "adad") + "\">adad</a>";
}
#region IPostBackEventHandler 成员
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
{
ltmain.Text += "xxx";
//throw new NotImplementedException();
}
#endregion
}
.aspx 文件里有这些代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<link type="text/css" href="yangshi.css" rel="Stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<div id="div1"><asp:Button ID="submit" runat="server" Text="搜索" onclick="submit_Click" />
<asp:Literal
ID="ltmain" runat="server"></asp:Literal>
</div>
<ul></ul>
</form>
</body>
</html>
为什么点了那个button后再点这个链接就出现了这些:
“/WebSitetest”应用程序中的服务器错误。
无法找到资源。
说明: HTTP 404。您正在查找的资源(或者它的一个依赖项)可能已被移除,或其名称已更改,或暂时不可用。请检查以下 URL 并确保其拼写正确。
请求的 URL: /WebSitetest/__doPostBack('__Page','adad')
版本信息: Microsoft .NET Framework 版本:2.0.50727.3074; ASP.NET 版本:2.0.50727.3074
紧急紧急!