Do it from code behind in load event as
HyperLink1.NavigateUrl = "attendance1.aspx?albumid=" + clickedalbum;
ok do it as follows:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#clickedalbum %>' Text="Testlink"></asp:HyperLink>
</div>
</form>
</body>
</html>
In the code behind:
using System;
public partial class test : System.Web.UI.Page
{
public string clickedalbum = "";
protected void Page_Load(object sender, EventArgs e)
{
clickedalbum = "attendance1.aspx?albumid=123";
DataBind();
}
}
For details visit this link Why will <%= %> expressions as property values on a server-controls lead to a compile errors?