我试图在一个页面中显示超链接,当用户单击链接时,页面正在导航,但我想获取超链接的名称并在不同的网页中显示为标签。在这里我正在尝试使用 cookie,但是 cookie 只需要数据库的最后一个值,可以将所有值存储在 cookie 中吗?谢谢
String sql1 = "select title,song_id from up_song where Song_type='Indian Pop Album'";
adpt = new SqlDataAdapter(sql1, cn);
ds = new DataSet();
adpt.Fill(ds, "title1");
var last6Uploaded1 = ds.Tables["title1"]
.AsEnumerable()
.OrderByDescending(r=> r.Field<int>("song_id"))
.Take(2);
foreach (DataRow row in last6Uploaded1)
{
int songID = row.Field<int>("song_id");
// you don't need the array of hyperlinks neither
HyperLink hl = new HyperLink();
hl.ID = "hyperlink" + songID;
string title = row.Field<string>("title");
hl.Text = title;
hl.NavigateUrl = "Downloadpage.aspx";
hl.ForeColor = System.Drawing.Color.White;
HttpCookie coo = new HttpCookie("song");
coo["sogtit"] = title;
Response.Cookies.Add(coo);
Panel2.Controls.Add(hl);
Panel2.Controls.Add(new LiteralControl("<br>"));
}