Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Form values from asp.net to standard asp 3

Status
Not open for further replies.

JoDaCoda

Programmer
Dec 11, 2003
18
US
I am trying to update an old application that used asp. I have created a new asp.net page that allows users to pick options, and then redirects them to an asp page. The asp page needs to read the form object values from the asp.net page. I haven't been able to get this to work with anything I've tried. I have tried two methods of redirecting back to the asp page (response.redirect and server.transfer). Neither of those work.

Response.redirect opens the asp page, but the form object is not sent.
Server.Transfer creates an error since asp and asp.net do not use the same ISAPI extensions.

Does anyone know how to do this?

 
Maybe some of the responses in thread855-1000731 will help you as it is basically the same problem.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Thanks for the link. I think I may have found an easier way though. I made two forms on my page. One for hidden html inputs for the asp page to read, and another for the .net controls (which is set runat=server). I then use javascript to update the html controls in the first form based on what the users choose in the .net form.

**Hint: You must put the html form before your .net form. If you put the form for the .net controls first, the asp page won't read the form object.

 
OK - glad you found a solution. Maybe you could post a simple example so other user's could see how you did if if they come across the same problem?

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Sure. This is a simplified example of what I did. form1 is for objects that the asp page is to read from. form2 is for the asp.net controls. I put an html button on form2 that has javascript attached to its onclick event. The javascript fetches the values from form2 and puts them in form1, then submits form1 back to the asp page.

HTML code:
<form id="form1" name="form1" method="post" action="somepage.asp">
<input type="hidden" name="field1" id="field1">
</form>
<form id="form2" runat="server">
<asp:dropdownlist id="ddlItems" runat="server" Width="376px" AutoPostBack="True"></asp:dropdownlist>
<input id="btnSubmit" style="WIDTH: 73px; HEIGHT: 24px" type="button" value="Go" onclick="SetAspForm();">
</form>



javascript:
function SetAspForm()
{
var obj = document.form2.ddlItems;
var objIndex = obj.selectedIndex;
document.form1('field1').value = obj(objIndex).value;
form1.submit();
}
 
I second Veep's "cool"! - thanks for posting!

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top