Link to home
Start Free TrialLog in
Avatar of Ernesto
ErnestoFlag for Mexico

asked on

I have a form in html how to declare a codebehind in vb.net in the submit button?

I have a form in html how to declare a codebehind in vb.net in the submit button in order to store the fields data on database?

regards
Avatar of Robb Hill
Robb Hill
Flag of United States of America image

so you have a vb.net html form....you want to click this form...and then you will capture the values of the html fields into appropriate variables in the codebehind...string..int..ect.

So now you have the form in memory.


Now you will need to build some crud operations....or use entity framework to do this....

to persist the values to the objects represented by the database.
if it is a *.html page then there is no code behind it must be an *.aspx and you create an aspx button rather than an html button
<button type="button">Click Me!</button>

Open in new window

Generally, your controls (fields) in your front end (html, .aspx) should be defined as runat="server" , and then you need some database objects in order to connect to a backend database, and do your execution.

some references as a start

Commands and Parameters
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/commands-and-parameters

Executing a Command
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/executing-a-command

ASP.NET Data Access Options
https://msdn.microsoft.com/en-us/library/ms178359(v=vs.110).aspx

Working With Command Object in ADO.NET
http://www.c-sharpcorner.com/UploadFile/c5c6e2/working-with-command-object/
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.