Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to remove hyperlink on the aspx page with help of session in asp.net?
Posted

you can access from another page to master page but let sat the easy way:

in your master page check a session that if that session if isn't null then show the hyperlink ,else make it disable.
and in that page set the session on page InIt!
 
Share this answer
 
v2
Your question is not clear,I think you want to hide hyperlink if session have or not have value.use as
Use
C#
if(Session["userid"]==null)
{
HyperLink1.Visible=false;
}

use on pageload of contentpage
C#
((HyperLink)this.Master.FindControl("HyperLink1")).Visible=false;
 
Share this answer
 
v2
Comments
[no name] 6-Jun-12 8:02am    
sorry actually i have hyperlink on ma master page through which my page will be redirected to the another page...after the redirection we will reached on that page......from that page i want to remove my hyperlink but there is no access of hyperlink on that another page...because we placed that hyperlink on our master page...so can you tell me solution ?/? thanx in advance.
AmitGajjar 6-Jun-12 8:17am    
you mean to say that, on first page you want the link but you do not want link on other pages. is it so ... ?
uspatel 6-Jun-12 8:19am    
check updated answer...
[no name] 6-Jun-12 8:23am    
@amit:yes sir you are right
[no name] 6-Jun-12 8:25am    
@uma:there is no access of .master.....
You don't need Session to remove any hyperlink from your aspx page.

If it is based on design then remove the hyperlink tag altogether. If at runtime, based on certain scenario you don't want the hyperlink then just hide it. Use the 'Visible' property of the hyperlink and play with it's visibility.
 
Share this answer
 
Comments
[no name] 6-Jun-12 8:04am    
sorry actually i have hyperlink on ma master page through which my page will be redirected to the another page...after the redirection we will reached on that page......from that page i want to remove my hyperlink but there is no access of hyperlink on that another page...because we placed that hyperlink on our master page...so can you tell me solution ?/? thanx in advance.
Sandeep Mewara 6-Jun-12 9:14am    
You can always access controls of your master page.

This.Master.FindControl("MyHyperlink").Visible = false;
[no name] 6-Jun-12 9:33am    
@sandeep:there is no access of master page in another .ascx page
[no name] 6-Jun-12 9:38am    
@sandeep:there is no effect on that linkbutton its visible to me....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900