<ul runat="server" id="hide">
<li> <asp:hyperlink id="HyperLink1" runat="server" navigateurl="userwelcome.aspx" xmlns:asp="#unknown">My Page</asp:hyperlink></li></ul>
and in codebehind i wrote
if (Session["email"] == null)
{
HyperLink1.Visible = false;
hide.Visible = false;
}
else if (Session["email"] != null)
{
HyperLink1.Visible = true;
hide.Visible = true;
}
I Added
Runat="Server"
and
id="hide"
to
<ul>
tag then set the visibility false when session is null else true :)