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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form submit to another page

Status
Not open for further replies.

stonehead

Technical User
May 2, 2007
58
US
Hi all,

I'm totally new to .NET. I'm trying some simple stuffs and stuck with form submit. Any help is appreciated it.

Form1:
form method="get" action="/IMap.aspx" id=form2 name=form1>
<b><i>Enter Facet Number:&nbsp;&nbsp;&nbsp;</i></b>
<input name="map" type="text" size="5">
<input type="submit" value="Send" id=submit1 name=submit1>
</form></p>

iMap.aspx: How do I get the input "map" in the previous form ?
in asp it's just this simple
<% map = Request("map")%>

Thank you.
 
with webforms 99% of the time your submit back to the same page (postback model). with 2.0 you can set the postbackto property, or something like that for buttons and other postbakable controls.

if you're looking for more tranditional web development practices (like writing html, css and js) check our ms mvc or castle monorail.

while there are move moving parts. it's much easier to maintain because 1. objects are testable and 2. each object get one responsibility.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Stonehead so am I and I am having the same problem with NET. I just don't know enough yet and I am still buying books looking for the one that is the winner. Since our site uses rotator ads and our hosting company only supports NET I can't use ASP therefore I need to redo my forms too.

I need to carry a value from a form on one page to another (it is a hidden field) and I have no idea how to do that with net. It is a boolean field nothing more and if it is yes load the page otherwise put the user back on the eula page. In ASP it was a no brainer and now I am forced to redo everything to make the magic happen. If you figure it out please let me know; I would appreciate it. You can't mix ASP with NET and everything in net needs to be in a form. What a joy!

Life's a journey enjoy the ride...

jazzz
 
You can use cross page posting. You can look it up in help. As Jason says, usually the page posts back to itself. If you want a confimation page to show for example, then I use the multiview control. It allows for different views on the same page. So, the first view can be the default with the form, then once it is summited and validated, etc, you can then show a different view with a thank you message...

ASP.NET is much different than classic asp programming. But once you get used to it, you will find it much better in many ways, especially for debugging and OOP concepts.
 
jbenson001 thank you and I can see its advantages already but it is so frustrating trying to get a handle on it after using ASP for years. I know once I get it figured out it will be a breeze. Do know of any books that are any good on it. I do have two and they are basic getting started books but I need something a little heavier than that because our site is pretty event driven and these just won't cut it. I live in the sticks so I can't jump in the car and go to a book store. I have to rely on reviews and you know how they are.

Life's a journey enjoy the ride...

jazzz
 
I've always like the books by the publisher Wrox. They should have books for different levels of programming knowledge.

I find the best way to learn is by doing. And there are so many forums, blogs and articles on-line to help. Remember, Google is your friend.
 
Passing variables is absolutely no different in ASP to ASP.NET, you either use a POST or a GET (i.e. via the form or the querystring) to pass the values (after all, both languages just spit out HTML and that is then being used to pass the values).

How you then interact with the variables is slightly different, but not a great deal.

Mark,

[URL unfurl="true"]http://lessthandot.com[/url] - Experts, Information, Ideas & Knowledge
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Website Design
[URL unfurl="true"]http://aspnetlibrary.com[/url] - An online resource for professional ASP.NET developers
 
Mark, can you give me an example on how to do this, nothing fancy just something to dissect. Thanks...

<form id="frmeula" action="mypage.aspx" method="get" runat="server">
<div>
<asp:TextBox ID="TextBoxEula" runat="server" Columns="51" ReadOnly="True"
Rows="18" TextMode="MultiLine"></asp:TextBox>
<br />
<br />
<br />
<asp:Button ID="submit" runat="server" Text="I Agree" Font-Bold="False"
Font-Size="Small" />&nbsp;&nbsp;&nbsp;
<asp:Button ID="Cancel" runat="server" style="margin-left: 0px"
Text="I Decline" Font-Bold="False" />
<br />

</div>
</form>

Here is what I have there are no errors when I debug but I don't go to the page named MyPage when the user clicks I agree. This is just some code I am messing with to get a handle on this.

Life's a journey enjoy the ride...

jazzz
 
Mark, excellent point. asp.net abstracts so much of the basic http away from programming that developers forget, or just don't know, how simple it is. of course, when you do attempt to make it simple by getting back to raw http requests, webforms throws a fit:)

stonehead and jazzz, you may want to take a look at MS MVC or Castle Monorail. these are web frameworks designed around the Model View Controller concept. the workflow is much simpler and writing hthml is very simple. There is a greater learning curve because there is not a pretty GUI and wizards, but they hinder growth anyway :)

I finally backed away from webforms this year. (news years resolution in a way). I began working with Monorail in January and loving it. I've only scratched the surface about the feature provided by monorail, but the core features are very easy to work with.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Ok I got it all figured out and if anyone needs to know what I did please drop me an email and I will share it with you. Thanks to everyone that helped.

Life's a journey enjoy the ride...

jazzz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top