-1

I have about 50 or so links similar to the following:

     <asp:TableCell Font-Bold="true"><asp:Hyperlink ID="Hyperlink9" runat="server" CssClass="Hyptext" Name="HypLink1" TextDecorations="None" NavigateUrl="~/Folde1/Second.aspx" Text="Case Study 12 "/></asp:TableCell>  

What I like to do is when the user clicks on the hyperlink, I like to validate that the user has permission to view the links. If so, they can view it. If not, a pop-up will come information them that they need to sign in order to view the links.

Questions

1) What is the best way when the user clicks on the HyperLink to do a server side click event. From what I seen,only a client side even can be done with the asp:Hyperlink. I like to then validate if they have permissions. If not, throw a pop-up window.

1
  • Stick with ASP.NET's built in authorization mechanism rather than rolling your own.
    – mason
    Aug 29, 2014 at 19:53

2 Answers 2

1

You should not do that. Instead, you should...

On server side, check to see if user is logged in...

  • if not logged in, provide login link and text "Login to see case studies".
  • if already logged in, provide links user has access to.
0

You need an onClick tag that points to a method. Create one event handler function and point all your hyperlinks to it. Once the event handler fires, cast the sender to Hyperlink and go from there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.