Click here to Skip to main content
16,009,467 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I had written code to Enable and disable hyperlinks on master page from the content page. Every thing is working fine and the hyperlinks are getting disabled also after calling the DisableHyperlinkInMasterPage Method. When i am calling the EnableHyperlinkInMasterPage method still the hyperlinks are not working. If we are leaving that page , then i found that the hyperlinks starts working. My issue is after calling the EnableHyperlinkInMasterPage method , without leaving the page the hyperlinks are still disabled and not working and after leaving the page it getting enabled . Please help me that how i fix this issue.I debug the code and not found any error on EnableHyperlinkInMasterPage method.


C#
private void DisableHyperlinkInMasterPage() 
    { 
        AssociateMaster mymaster = (AssociateMaster)Page.Master; 
        HyperLink home = (HyperLink)mymaster.FindControl("Home"); 
        home.Enabled = false; 
        HyperLink profile = (HyperLink)mymaster.FindControl("ProfileLink"); 
        profile.Enabled = false; 
        HyperLink report = (HyperLink)mymaster.FindControl("Report"); 
        report.Enabled = false; 
        HyperLink signout = (HyperLink)mymaster.FindControl("SignOut"); 
        signout.Enabled = false; 
    } 
 
    private void EnableHyperlinkInMasterPage() 
    { 
        AssociateMaster mymaster = (AssociateMaster)Page.Master; 
        HyperLink home = (HyperLink)mymaster.FindControl("Home"); 
        home.Enabled = true; 
        HyperLink profile = (HyperLink)mymaster.FindControl("ProfileLink"); 
        profile.Enabled = true; 
        HyperLink report = (HyperLink)mymaster.FindControl("Report"); 
        report.Enabled = true; 
        HyperLink signout = (HyperLink)mymaster.FindControl("SignOut"); 
        signout.Enabled = true; 
    } 
Posted
Comments
Christian Amado 28-Aug-12 17:27pm    
Very rare behavior. Have the same issues. Let me investigate =)
Dharmenrda Kumar Singh 3-Sep-12 8:32am    
You got any solution @Christian, I am still struggling

1 solution

C#
private void DisableHyperlinkInMasterPage() 
    { 
        AssociateMaster mymaster = (AssociateMaster)Page.Master; 
        HyperLink home = (HyperLink)mymaster.FindControl("Home"); 
        HyperLink profile = (HyperLink)mymaster.FindControl("ProfileLink");
        HyperLink report = (HyperLink)mymaster.FindControl("Report");
        HyperLink signout = (HyperLink)mymaster.FindControl("SignOut");
        home.NavigateUrl= string.Empty;  
        profile.NavigateUrl= string.Empty;  
        report.NavigateUrl= string.Empty;  
        signout.NavigateUrl= string.Empty;
    } 
 
    private void EnableHyperlinkInMasterPage() 
    { 
        AssociateMaster mymaster = (AssociateMaster)Page.Master; 
        HyperLink home = (HyperLink)mymaster.FindControl("Home");
        HyperLink profile = (HyperLink)mymaster.FindControl("ProfileLink");
        HyperLink report = (HyperLink)mymaster.FindControl("Report");  
        HyperLink signout = (HyperLink)mymaster.FindControl("SignOut");
        home.NavigateUrl= "your_url"; 
        profile.NavigateUrl= "your_url"; 
        report.NavigateUrl= "your_url";  
        signout.NavigateUrl= "your_url";  
    } 


It works. Certified & Tested! :)

Hope it helps.
 
Share this answer
 
Comments
Dharmenrda Kumar Singh 29-Aug-12 6:49am    
No, Its also not working...

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

  Print Answers RSS


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