473,388 Members | 1,385 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Changing Links - VB - ASP.NET

Hey,

New to asp and I need some help.

I created a jump menu that links to different portals. Each portal has all the same images/text, but I wanted to change all the links on each portal to match up with the selection from the jump menu. How would I go about doing that?

Thanks
Oct 24 '08 #1
10 1568
jhardman
3,406 Expert 2GB
Hey,

New to asp and I need some help.

I created a jump menu that links to different portals. Each portal has all the same images/text, but I wanted to change all the links on each portal to match up with the selection from the jump menu. How would I go about doing that?

Thanks
That depends on a lot of things. Show me your code, especially how your page currently looks (with all the same images and text), how you have your links stored etc.

Jared
Oct 24 '08 #2
That depends on a lot of things. Show me your code, especially how your page currently looks (with all the same images and text), how you have your links stored etc.

Jared

www.gotoog.com/test.asp is the homepage.

www.gotoog.com/beauty_health.html is an example page. When someone selects a representative I want the all the links on the page to change. I don't really know how to code it so I don't have any code yet, cause I just started learning, but I don't want to have to create 30 pages.
Oct 24 '08 #3
jhardman
3,406 Expert 2GB
www.gotoog.com/test.asp is the homepage.

www.gotoog.com/beauty_health.html is an example page. When someone selects a representative I want the all the links on the page to change. I don't really know how to code it so I don't have any code yet, cause I just started learning, but I don't want to have to create 30 pages.
So if I select a representative, and then click a link you want the selection I made to be passed on to the server? I didn't dig really deep into your code, but it looks like you already submit the form as soon as the user makes a selection. If this is the case, all you have to do is add that info to the links:
Expand|Select|Wrap|Line Numbers
  1. <a href="site.com/somepage.asp?rep=<%=request("representative")%>">somepage.asp</a>
Does this make sense?

The next simplest solution would be to have the place the select drop down in an iframe - submit the form doesn't renew the whole page, but you could store the info on the server as a session variable, or on the browser as a cookie. The cookie or session variable is then available every time a script generates a page and that info can be used behind the scenes as if the user specified every time he clicked a link. Does this make sense?

Alternatively, you could re-write the links so that they actually submit the form (no href attribute, just a onclick attribute going to some javascript function that submits the form with the representative info plus info of whichever link he chose).

You could also go for a pure javascript solution where selecting the rep changes the link, but that can be get pretty heavy into javascript, so maybe that wouldn't be the type of answer you are looking for.

Anyway, if any of these possibilities seems promising and you would like help getting them going, let me know.

Jared
Oct 27 '08 #4
So if I select a representative, and then click a link you want the selection I made to be passed on to the server? I didn't dig really deep into your code, but it looks like you already submit the form as soon as the user makes a selection. If this is the case, all you have to do is add that info to the links:
Expand|Select|Wrap|Line Numbers
  1. <a href="site.com/somepage.asp?rep=<%=request("representative")%>">somepage.asp</a>
Does this make sense?

The next simplest solution would be to have the place the select drop down in an iframe - submit the form doesn't renew the whole page, but you could store the info on the server as a session variable, or on the browser as a cookie. The cookie or session variable is then available every time a script generates a page and that info can be used behind the scenes as if the user specified every time he clicked a link. Does this make sense?

Alternatively, you could re-write the links so that they actually submit the form (no href attribute, just a onclick attribute going to some javascript function that submits the form with the representative info plus info of whichever link he chose).

You could also go for a pure javascript solution where selecting the rep changes the link, but that can be get pretty heavy into javascript, so maybe that wouldn't be the type of answer you are looking for.

Anyway, if any of these possibilities seems promising and you would like help getting them going, let me know.

Jared
Well I finished updating my site. All I did was manually put in the links. What I had in the jump menu was different reps. Each rep has their own ID and I wanted all the links in the page to change to their id so I didn't have to make 50 mirror pages which I did like an idiot.

So i need to create a database of the links and reps and then add that above code into all the links?

So for example i have the link

http://www.trueessentials.net/index.asp?repid=4319298

I only need the #'s at the end to change in all the links when a representative is selected in the jump menu. So at the end of repid I would add =<%=request("representative")%> correct?

Thanks for the help. Sorry it took so long to respond i was trying to changing my contact form from php to ASP so my flash contact form works.
Oct 27 '08 #5
jhardman
3,406 Expert 2GB
Well I finished updating my site. All I did was manually put in the links. What I had in the jump menu was different reps. Each rep has their own ID and I wanted all the links in the page to change to their id so I didn't have to make 50 mirror pages which I did like an idiot.

So i need to create a database of the links and reps and then add that above code into all the links?

So for example i have the link

http://www.trueessentials.net/index.asp?repid=4319298

I only need the #'s at the end to change in all the links when a representative is selected in the jump menu. So at the end of repid I would add =<%=request("representative")%> correct?

Thanks for the help. Sorry it took so long to respond i was trying to changing my contact form from php to ASP so my flash contact form works.
Yes, I believe that is right, it's hard to tell for sure without seeing your code, but if it is set up like I think it is, that will work. or possibly <%=request("repid")%> - the request collection lists everything in cookies, forms and URL querystring. Anyway, try it and let me know if it goes well.

Jared
Oct 27 '08 #6
Yes, I believe that is right, it's hard to tell for sure without seeing your code, but if it is set up like I think it is, that will work. or possibly <%=request("repid")%> - the request collection lists everything in cookies, forms and URL querystring. Anyway, try it and let me know if it goes well.

Jared
Ok, so I created a database. I named it repid and it has two columns, Rep and ID. I used a drop down list.

<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="repid"
DataTextField="Rep" DataValueField="ID">
</asp:DropDownList>
<asp:SqlDataSource ID="repid" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [Rep], [ID] FROM [repid]"></asp:SqlDataSource>

When they select a rep the value is equal to the id. I tried putting the request tag you suggested at the end of the link but I kept getting errors.

I'm trying to do it as a query string since that seems the easiest route.

So the url was http://xxx.asp?repid<%=request("id")%> which didn’t work. I kept getting the error, " server can’t contain <% %> constructs".

I’m using visual web developer 2008 and I set it to web form with VB and I unchecked place code in separate file. Any ideas on how to make it work?
Oct 31 '08 #7
JamieHowarth0
533 Expert 512MB
OK, now you're confusing the issue.

Your site is written in classic ASP, using the .asp file extension for each file, right?

Don't try and write more pages in Visual Web Developer, because they have the .aspx file extension (used with ASP.NET) and behave completely differently from how you're probably used to writing classic ASP.

My tip - stick to Notepad.

codegecko
Oct 31 '08 #8
No. They are all in aspx. I would stick to the notepad if I knew enough about ASP. You must of gotten the wrong idea. I don't know that much about ASP. I know I sound really smart and all, but I don't think programming ASP pages with notepad is the way to go at this point.
Oct 31 '08 #9
Here is the code I have right now:



Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Response.Write(DropDownList1.SelectedValue)


End Sub


<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedInde xChanged" DataSourceID="reps"
DataTextField="repid" DataValueField="id"></asp:DropDownList>



<asp:SqlDataSource ID="reps" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [repid], [id] FROM [reps]"></asp:SqlDataSource>


All the links look like this :http://www.madeup.net/index.asp?repid=id

The drop down menu changes and reloads the page, but it just puts the id at the top of the page and repreats it twice.
Oct 31 '08 #10
jhardman
3,406 Expert 2GB
No. They are all in aspx. I would stick to the notepad if I knew enough about ASP. You must of gotten the wrong idea. I don't know that much about ASP. I know I sound really smart and all, but I don't think programming ASP pages with notepad is the way to go at this point.
That's the problem! No wonder our answers didn't help at all! You have asked your question in the ASP forum, but you are actually working with ASP.NET. ASP (file extension .asp) is not compatible with ASP.NET (file extension .aspx), hence the confusion.

I'll move your thread over to the correct forum, and they should be able to give you the correct solution.

Jared
Oct 31 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: mvargasp | last post by:
Hi all, I have a web form which contains a frame, (a form containing a menu on the left and a web form containing a datagrid on the right). Also there is a button (right side) which transforms...
6
by: Carla | last post by:
hi people, I have a little problem that I can't solve with css and i was wondering if you could help me. I have 4 links, I want that when I click/mouseover in the link 1, it turns to a color...
14
by: Don G | last post by:
Within the menu for my site, I have inserted 'class="current"' within the link for the current page. So the link looks somthing link: <li><a href="index.php" class="current">Home</a></li> The...
2
by: James M. | last post by:
I have 2x Front-end Web servers (Win2003 Ent IIS6.0), setup with NLB (single Affinity, also using SQLServer session state) that are hosting a few .NET ASP web applications under the Default Website...
1
by: msnews.microsoft.com | last post by:
Calendar Control: Changing the Month Display and Navigation Links http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskCustomizingCalendarWebControlAppearance.asp ...
18
by: Chris Hills | last post by:
A lesson in Posting How many C.L.C group posters does it take to change a C light bulb? 1 to change the light bulb and to post that the light bulb has been changed 14 to share similar...
9
by: sebzzz | last post by:
Hi, I work at this company and we are re-building our website: http://caslt.org/. The new website will be built by an external firm (I could do it myself, but since I'm just the summer student...
5
by: annaGold | last post by:
Hello, I wrote this simple javascript to demonstrate my problem with IE6 & 7. The code works find in Mozilla, but in IE my email link on the page is changed to the new href. Only href should change,...
4
by: sgxbytes | last post by:
Hi, My html has <Table style="year-button-archive" width="60%" > <tr> <td class="gold" > <a title="year">By Year:</a> <td class="gold"> <a id = "2008"...
2
by: jkizmannRU09 | last post by:
I know how to adjust the look of visited links with a CSS stylesheet, but how would one create individual variations among a set of links? For example, say I have three links, all initially...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.