views:

181

answers:

2

I have a page which is used to display numerous forms for the user to fill out and get reports generated. Each of these forms is inside it's own ASP:Panel control so that I can toggle the visibility of the form (so that only those with appropriate permissions get access to the reports they are allowed to).

The client has now requested a "table of contents" like area on the page with hyperlinks pointing to each of the forms (so that they don't have to spend time scrolling the page to find the particular report form they want). This is easy to accomplish using standard <a href="#Area"> and <a id="Area"> tags. What I am now looking for is a way that would allow me to hide the links of reports that the user does not have access to.

I was first thinking of using the ASP:LinkButton control, but I do not want any postbacks to occur from clicking the links (that would be very unnecessary). Are there any other methods I could use to accomplish the same goal? I am looking for something which would make it easy for me to toggle the visibility of the corresponding link at the same time I am toggling the visibility of the panels containing the report forms (done now from the code-behind).

Note: Using VB as the language

+2  A: 

If you use link controls you can just show or hide the link bases on the visibility of its related panel.

Link1.Visible = Panel1.Visible
Andy Rose
I think I'm going to end up doing a serious facepalm here because I constantly forget there is just a regular ASP:HyperLink control.
TheTXI
LOL. Happens to the best of us.
Andy Rose
A: 

I was first thinking of using the ASP:LinkButton control, but I do not want any postbacks to occur from clicking the links (that would be very unnecessary)

I disagree. You're talking about redrawing most of the page each time a link is clicked, making a full postback appropriate from a technical standpoint. Additionally, users are conditioned to expect a round-trip to the server when they click on links. That's what a hyperlink normally does. So it's also appropriate from a user-experience standpoint.

Joel Coehoorn
Joel: I would not need a round trip. The page is only being drawn once (when they first enter). On first arrival of the page, all the pieces of the form they have access to are drawn. All the links should do is drop them further along the page to the appropriate anchor.
TheTXI
Then normal anchor tags would be enough. I was under the impression that only one panel was shown at a time. If that were the case, you would want to go back to the server on request rather than try to render everything upfront.
Joel Coehoorn
@Joel: Prior to the client changing his mind, I was displaying only a single category's forms at a time when they opened up a larger panel. Unfortunately the client decided he wanted everything that was able to be seen to all be seen at one, which then led to this table of contents-style request.
TheTXI