pass variables through input button to another page

manared

Well-known member
Joined
Jun 1, 2006
Messages
84
Programming Experience
1-3
I have a 2005 web application with a button (Input) that opens another aspx page. I was wondering if there is a way that I can send variables to the second page using an input button. Here's my source code for the button:

HTML:
<INPUT Type="button" OnClick="window.open('Specs.aspx', 'win1',
'width=500,height=200,menubar=no,toolbar=no,scrollbars=yes,resizable=yes')"
                 value="..." id="specs" />

I have several of these buttons and some I need a variable from a textbox and some I need to pass a variable from a drop down list. Does anyone know how I can do this? Thanks!!!
 
*cough* ASP.NET question *cough* this is VB.NET discussion area.. *cough*

PM a mod and ask for a move; dont cross-post
 
Thread was moved to ASP.Net section.

You can post querystring variables to page:
VB.NET:
Specs.aspx?var1=test&var2=some&var3=more
These variable values can be retrieved from application with Request.QueryString("var1")
 
Thanks!! Am I able to pass values such as txtName.text or ddlSpecs.SelectedValue at all through this?:confused:
 
The values have to be strings, and you have to UrlEncode them (for example a space becomes %20). Do this with Server.UrlEncode, when reading it back you UrlDecode it.
 
I'm not sure if I understand how I can use this. I have an asp:dropdownlist (or a text box) that the user picks to select a value. Then I have an html input button that calls the other aspx page. So the value I'm grabbing isn't in html, it's an asp item. Will this still work?

Do you know if there is a way where I could have an asp button in my program, and have that call another aspx page, but have it open in a new window? Kind of like a pop up box? That may work the best. Thanks!
 
Yes, I think it will work. Check also the links of post 3 here.

To open a new window you have to use the Javascript window.open function.
 
Back
Top