Looks like your datasource is filtered by ArtType_ID and you want to have a link in the DataList header to pass the ID to NewsPage.aspx
.
The problem is, Header doesn't repeat with item.So you can't bind <a>
with ArtType_ID. But you can have a easy workaround.
In the code add a property named ArtType
, and a Method named GetArtType
and where you are binding the datasource to the DataList, get the ArtType_ID, save in ArtType:
public string ArtType { get; set; }
public string GetArtType()
{
return ArtType;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//datasource is the name of your datasource
ArtType = datasource.First().ArtType_ID.ToString();
DL_ElarabyNews.DataSource = datasource;
DL_ElarabyNews.DataBind();
}
}
Now in the markup you can access the GetArtType, your HeaderTemplate should look like:
<HeaderTemplate>
<div class="araby-news-title">
<a href='NewsPage.aspx?ArtTypeID=<%# GetArtType()%>'>Test</a>
</div>
</HeaderTemplate>
Hope it helps!