Code代码片断(5do8)

GDI+控件线程IO流ADO.NET接口类,函数语法

新主题
c# cache与数据库映射
建立 CLR Stored Procedur...
access left join 两个
lucene.net提高查询速度
DataList 页面跳转
OnItemDataBound绑定事件
sql事务执行
SqlParameter添加数据
说话自由

首页 » .NET/C# » ADO.NET »

DataList 页面跳转

标签: DataList hyperlink Redirect
方法(1):
<asp:datalist
<itemtemplate>
<a href='detail.aspx?id=<%# Eval("ID") %>'><%# Eval("Name") %></a>
或:
<asp:hyperlink navigateurl='<%# Eval("ID", "showdetail.aspx?id={0}") %>' text=<%# Eval("Name") % runat=server />
<itemtemplate>
方法(2):
<asp:datalist OnItemCommand="DataList_ItemCommand"
<itemtemplate>
<asp:LinkButton ID="LinkButton" Runat="server" Text="详细" CommandName='<%# Eval("ID") %>'/>
<itemtemplate>
后台:
protected void DataList_ItemCommand(object Sender, DataListCommandEventArgs e)
    {
        string str = e.CommandName;
        string id = "";
        //未放置UpdatePanel,使用如下语句跳转页面
        //Response.Redirect("showdetail.aspx?id="+str);
        ClientScript.RegisterStartupScript(this.GetType(), "clientScript", "<script language='javascript'>window.open('showdetail.aspx?str="+str+"');</script>");
        //设置UpdatePanel,使用如下语句跳转页面
        //ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "clientScript", "window.open('showdetail.aspx?str=" + str + "');", true);
    }

ccdot写于2008-9-9 21:53:12

如果愿意,请留下你观点或者感受...
称呼*
内容*
验证码*