求一份asp.net网页跳转代码 从.net新闻列表页面点击标题时,怎么在另一个页面显示这个
发布网友
发布时间:2022-04-27 15:53
我来回答
共1个回答
热心网友
时间:2022-04-27 17:23
list.ASPX
<td class="center">
<asp:Button ID="LinkButton2" runat="server" ToolTip=' <%# Eval("pkid") %>' OnClick="btnCreate_Click" Text="查看" CssClass="button" />
</td>
list.CS
protected void btnCreate_Click(object sender, EventArgs e)
{
string pkid = ((Button)sender).ToolTip;
response.redirect("show.aspx?id="+pkid);
}
show.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
var pkid = request.querystring("id");
var NewsModel = BLL.News().GetModelByCache(int.prase(pkid));
this.txtTitle = NewsModel.Title;
this.txtDesc = newsModel.Desc;
}
}