I find myself in a challenging situation without a clear solution at hand.
Within this code, I am utilizing a link and a button for which I need to save the page in a database. Therefore, creating a server control is not an option as it will not be rendered properly.
<div id="DivCMS" runat="server"></div>// This is used on the server side
// The following code is saved in a database table named CMS_Pages
<a href="User/Register.aspx" id="alinkRegister" >
<img src="App_Themes/White/Images/getstarted.png" style="padding-left: 117px;" />
</a>
// End of code saved in database table CMS_Pages //
Upon loading the page, I populate the div with data from the database.
if (!IsPostBack){
var cp = new CMS_Pages();//Data Access block
cp.LoadByPrimaryKey(12);// Load data
LiteralControl Ref = new LiteralControl(cp.PageHeader);
Page.Header.Controls.Add(Ref);
DivCMS.InnerHtml = cp.PageHtml;}
Is there a way to disable the href attribute based on session information using JavaScript?
If (session["UserId"] !=null) then href=# <br>
else href="User/register.aspx"