Hi...Someone please help. I have a web site that is based on information in a database. It is used to sign people up for events or classes. So an event is created, a link is provided with the query string for that event, then people can view the different times of that event on a calendar. On the calendar a link is provided to have people sign up for the event. Now I can pass the query strings along when people click on itmes and buttons, etc on the web form. Here's my problem. I have a menu on the left hand side that also has links to these pages and others like take attendence and some reports. Well, when a menu link is clicked on it loses the query string and I am not sure how to keep that. Can somebody help, please?

Jesi,

Is the menu on the left side within the same frame/container as the other content or separated?

If it is separated you might be able to maintain the variables by declaring them outside of both containers and allowing access to them from either container. More or less setting them as global variables instead of local variables within the main container.

Without seeing actual coding references I wouldn't be able to be more specific in pinning down your issue at this point.

Hope this helps :) If it does, please mark as solved.

P.s.: this probably should have gone into the ASP.Net forum :P

The site is basde off of a master page, so the links on the left are just formatted from that through a css file, there are no containers on the page.


Sorry about posting this in the wrong place ;)

Ok, well in that case...

If both the created links and the static links are within the same page environment...

You should be able to dynamically determine the static link values with some code-behind at the time of generation of the created links.

It would involve a bit more creative thought in the way you manage the links and may involve some variable placeholders within the code of the page itself (as opposed to the code-behind) but you should be able to get a generally working process going by using something like:

<a href="<%= urlVariableHere %>">

or similar. In this way you can set the required variable on the URL to match the values generated in your dynamic links.

That's just a first approximation thought on how to do it though.

Edit: Easy way to do this is to set up some Visible=false <asp:Label> on the page with their text components set to contain the generated URLs and use their labelName.Text property to populate the variable in the static URLs

Ok thanks that does sound like a good idea. I know how to put the information into a label, but how do you add the information in the label to the end of the navigationurl? Sorry I've never done that part before can you please give me some direction? Thank you.

Actually...

I just found a MUCH simpler and neater solution for you :)

for your static URLs:

<a href="" id="url1" runat="server">test1</a>

and in the code-behind:

url1.HRef = "http://www.test.com";

You can declare an ID and runat environment into your <a> tags allowing you to dynamically set their properties in code-behind. So, essentially, you can declare your side-menu URLs at the same time you declare your in-content links and they will both contain the same information eliminating your problem entirely... unless I've lost track of what the problem was in the first place lol

Ok, that sounds good but forgive for asking for more detail. Currently my menu links are formatted like this:

<asp:HyperLink ID="eventLink" NavigateUrl="www.default.aspx" runat="server">Calendar</asp:HyperLink>

of course the link needs to look like this www.default.aspx?=id...then the number. With your explaination above how would I do what you are suggesting? I do a lot of database stuff and have just started developing web forms so I need a little more of an explanation please. .Thank you

well the thing there is if you're using <asp:Hyperlink> that's almost identical to the <a href="" id="urlID"> example I was giving.

you can leave the format as:

<asp:HyperLink ID="eventLink" NavigateUrl="" runat="server">Calendar</asp:HyperLink>

and your code-behind would look like

eventLink.NavigateURL = "default.aspx?id.....";

In this way your URL component of the <asp:HyperLink> is determined at the code-behind level.

Ok, I will try that. Thank you for all your help Lusiphur.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.