Silly newbe question -Forms

A

ampeloso

Hello,
I'm trying to understand how a aspx form gets submitted to the server
when there is no action attribute. I am under the impression you would
need some kind of html valid button attribute in order to get the form
to post.Since Asp.net is browser independent ,how does the form know(
within the confines of the xhtml or html specs)that it is supposed to
go anywhere.(Even to itself)
No "action" and no "value= Submit" attributes?

Thanks
Mike
 
B

blackstaronline.net

When you specify your submit button on the form you set the OnClick
event to a Sub Routine. That sub can process the form. Like this.

---> The below code is under the <Script> tags of your page or in a
codebehind page
Public Sub Form_Submit(sender As Object, e As System.EventArgs)
'Code to process form, save in database or whatever you want
End Sub

---->The below code is inbetween the <form> tags on your page
<Form Runat="Server">
<asp:button runat="Server" ID="btnSubmit text="Submit"
OnClick="Form_Submit"/>
</Form>


Hope this helps,
Jeremy Reid
http://blackstaronline.net/hgtit
 
A

ampeloso

"Public Sub Form_Submit" does not submit the form to the server either,
it's just a function?Could be clientside?Right?
 
B

blackstaronline.net

The 'Runat=Server' specifies that it will process on the server. With
that the page will get handed to the client as HTML. Your actual VB or
C#, etc. code is not passed to the client (obviously). The form will do
a postback to the server calling your Sub server side.

Are you interested in doing client side programming?
 
A

ampeloso

"Runat" is not a valid html attribute.So that cant tell the browser to
send back to the server.
I'm just trying to find out how the form gets sent back.It MUST be sent
back within the specifications.
You just cant make up tags.
I know it works, but why??
Mike
 
E

Erik Funkenbusch

"Runat" is not a valid html attribute.So that cant tell the browser to
send back to the server.
I'm just trying to find out how the form gets sent back.It MUST be sent
back within the specifications.
You just cant make up tags.
I know it works, but why??
Mike

hint: Look at the source code you see in the browser with view->source
 
B

blackstaronline.net

Yes, I realize that "Runat" is not valid HTML code. The .NET server
inserts some of the necessary client side commands into java for you.
You should check out http://asp.net they have some great articles on
the inner workings of the .NET framework that might be a little more
helpful for you.


Jeremy Reid
http://blackstaronline.net/hgtit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top