Is this a stupid question?

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I'm looking for the command to direct a user to a new URL.
For example, in ASP, when you created a dropdown box, the
item selected could open a file - using the form
action="MyFile.asp"
How do you do a similar thing in ASP.NET??
 
use a client side form with an action thingie :)

its standard html so i don't see why that wouldn't work.
 
Set the AutoPostBack property of the DropDownList to True, then wire an
event handler for the SelectedIndexChanged event and in the event handler,
write Response.Redirect( yourDropDownList.SelectedItem.Value, true );
assuming that the Value of the SelectedItem is the URL to redirect the user
to.

Mario
 
Sorry, continued;
Class below - how can I call this array so that when the
strName "SomeMeeting" is selected in the dropdown box
The user is taken to the strPage "SomeMeetingPage.aspx"
?????
Structure MeetingInfo
Dim strName as string
Dim strPage as string
End Structure

Public Function GetMeetingList() as MeetingInfo
Dim arMeetings(11) as MeetingInfo
arMeetings(1).strName = "SomeMeeting"
arMeetings(1).strPage = "SomeMeetingPage.aspx"
etc etc

Return arMeetings
 
I agree with Steve, client side seems better for this. If you decide to go
that route I have a sample javascript for doing just this on my web site:
www. aboutfortunate.com

It's listed as: Open web page from drop down list

(Sorry, I haven't built in a search capability yet, but the library is still
small so it won't be difficult to find. I'll be adding a search soon
though.)

--
S. Justin Gengo, MCP
Web Developer / Programmer

Free Code Library At:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche


Kevin Spencer said:
Man, I see a whole lot of rather complex server-side solutions for this, but
I don't see a necessity for a server-side solution based upon your
requirements at all. What you need is to create a drop-down list box that is
populated on the server side, but on the client side, each option simply has
a value of what page you want to redirect to, and a text of whatever you
want. Add a JavaScript "onchange" client-side event handler that reads
something like the following:

<select name="whatever" size="1"
onchange="document.href=this.options[this.selectedIndex].value">
...

Remember that anything you can do on the client side is going to save you a
heck of a lot of load on the server side.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.

Steve said:
I'm looking for the command to direct a user to a new URL.
For example, in ASP, when you created a dropdown box, the
item selected could open a file - using the form
action="MyFile.asp"
How do you do a similar thing in ASP.NET??
 
I also agree with you, even though I'm one of those who posted one of the
server-side solutions. I was thinking of also providing a client-side
solution, but oh, well, what's done is done...

Mario

Kevin Spencer said:
Man, I see a whole lot of rather complex server-side solutions for this, but
I don't see a necessity for a server-side solution based upon your
requirements at all. What you need is to create a drop-down list box that is
populated on the server side, but on the client side, each option simply has
a value of what page you want to redirect to, and a text of whatever you
want. Add a JavaScript "onchange" client-side event handler that reads
something like the following:

<select name="whatever" size="1"
onchange="document.href=this.options[this.selectedIndex].value">
...

Remember that anything you can do on the client side is going to save you a
heck of a lot of load on the server side.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.

Steve said:
I'm looking for the command to direct a user to a new URL.
For example, in ASP, when you created a dropdown box, the
item selected could open a file - using the form
action="MyFile.asp"
How do you do a similar thing in ASP.NET??
 
Back
Top