You need to do this way
HTML
<div id="div1" runat="server">
</div>
C#
protected void Page_Load(object sender, EventArgs e)
{
//Set it from Database, Here i have set the property with hard coded value.
this.PID = 1;
div1.Attributes["data-href"] = string.Format("http://www.aspforums.net/mypage?PID={0}", this.PID);
}
Screenshot
