TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
469.5k
Submitting a form to be inserted to database sql?
Mar 19 2020 2:32 AM
Hi Team
I have this form that have created, i have created a table name on the database, i want to find out from this logic how do i submit it to that table name? Do i need to create store procedure as well? Mine does not do any crud operation, just it need to send this raw data to the table.
@
using
eNtsaRegistrationTraining.Models
@model EditTrainingRegFormViewModel
@{
ViewBag.Ttile =
"Dashboard"
;
Layout =
"~/Views/Shared/_HomeLayout.cshtml"
;
}
<!---This form
is
for
registration within a Dashbaord layout-->
<center>
<div
class
=
"z-inex"
style=
"width:1000px;"
>
<div
class
=
"register-logo"
>
</div>
<div
class
=
"card"
>
<div
class
=
"card-body register-card-body"
>
<center>
<img src=
"~/Images/eNtsa.png"
/>
</center>
<center>
<h1>
<p><b>Training Course Registration:Motion MasterClass</b></p>
</h1>
<hr />
<p>Course date: 25-27 February 2020</p>
<hr />
<p>
Note:Please note your registration
is
submit approval
as
seats
for
this
course
is
limited. Once your registration
is
confirmed, you will receive a quote
for
subject to your confirmation
followed by an invoice.
</p>
</center>
<hr />
@
using
(Html.BeginForm(
"editRegForm"
,
"Home"
, FormMethod.Post,
new
{ @role =
"form"
}))
{
@Html.AntiForgeryToken()
<div
class
=
"row"
>
<label
for
=
"Title"
>Title:</label>
<div
class
=
"input-group col-md-3 col-md-offset-3 col-sm-3 col-xs-3 "
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.Title,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
"title"
, autofocus =
"autofocus"
, placeholder =
"Title"
, required =
"required"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
<hr />
<form>
<div
class
=
"input-group mb-2"
>
<div
class
=
"input-group-prepend"
>
</div>
<label
for
=
"firstName"
>Name:</label>
<div
class
=
"input-group col-md-7 col-md-offset-7 col-sm-7 col-xs-7"
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.FirstName,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
"firstname"
, autofocus =
"autofocus"
, placeholder =
"First Name"
, required =
"required"
})
@Html.TextBoxFor(m => m.LastName,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
"lastname"
, autofocus =
"autofocus"
, placeholder =
"Last Name"
, required =
"required"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
</form>
<hr />
<div
class
=
"row"
>
<label
for
=
"Position"
>Position</label>
<div
class
=
"input-group col-md-3 col-md-offset-3 col-sm-3 col-xs-3"
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.Position,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
"position"
, autofocus =
"autofocus"
, placeholder =
"Position"
, required =
"required"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
<hr />
<div
class
=
"row"
>
<label
for
=
"Address"
>Company</label>
<div
class
=
"input-group col-md-3 col-md-offset-3 col-sm-3 col-xs-3"
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.Company,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
"company"
, autofocus =
"autofocus"
, placeholder =
"Company"
, required =
"required"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
<hr />
<div
class
=
"row"
>
<label
for
=
"Address"
>Address</label>
<div
class
=
"input-group col-md-6.9 col-md-offset-6 col-sm-6 col-xs-6"
>
<div
class
=
"input-group pull-left"
>
@Html.TextBoxFor(m => m.Address,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
" street address"
, autofocus =
"autofocus"
, placeholder =
"Street Address"
, required =
"required"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
<hr />
<div
class
=
"row"
>
<div
class
=
"input-group col-md-8.0 col-md-offset-6 col-sm-6 col-xs-6"
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.Address,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
" street address line 2"
, autofocus =
"autofocus"
, placeholder =
"Street Address Line 2"
, required =
"required"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
<hr />
<form>
<div
class
=
"input-group mb-2"
>
<div
class
=
"input-group-prepend"
>
</div>
<div
class
=
"input-group col-md-7 col-md-offset-7 col-sm-7 col-xs-7"
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.City,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
"city"
, autofocus =
"autofocus"
, placeholder =
"City"
, required =
"required"
})
@Html.TextBoxFor(m => m.State,
new
{ @
class
=
"form-control"
, type =
"text"
, id =
"state"
, autofocus =
"autofocus"
, placeholder =
"State/ Province"
, required =
"required"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
<hr />
<!--Zip code
for
postal code-->
<div
class
=
"input-group mb-2"
>
<div
class
=
"input-group-append"
>
</div>
<div
class
=
"input-group col-md-3 col-md-offset-3 col-sm-2 col-xs-2"
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.Code,
new
{
@
class
=
"form-control"
,
type =
"text"
,
id =
"postal code"
,
autofocus =
"autofocus"
,
placeholder =
"Postal/Zip Code"
})
@Html.ValidationMessageFor(m => m.Code,
""
,
new
{ @
class
=
"text-danger"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
</form>
<div
class
=
"row"
>
<label
for
"Email"
>Email:</label>
<div
class
=
"input-group col-md-4 col-md-offset-2 col-sm-2 col-xs-2"
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.Email,
new
{ @
class
=
"form-control"
, type =
"email"
, id =
"inputEmail"
, placeholder =
"
[email protected]
"
,
required =
"required"
,
pattern = @
"[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$"
, title =
"This field is required"
})
@Html.ValidationMessageFor(m => m.Email,
" "
,
new
{ @
class
=
"text-danger"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
<hr />
<div
class
=
"row"
>
<label
for
=
"Attendee Cell Number"
>Cell Number:</label>
<div
class
=
"input-group col-md-3 col-md-offset-1 col-sm-1 col-xs-1"
>
<div
class
=
"input-group pull-right"
>
@Html.TextBoxFor(m => m.Cell_Number,
new
{ @
class
=
"form-control"
, type =
"text"
, autofocus =
"autofocus"
, required =
"required"
})
@Html.ValidationMessageFor(m => m.Cell_Number,
" "
,
new
{ @
class
=
"text-danger"
})
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
<hr/>
<form>
<div
class
=
"row"
>
<label
for
=
"Please verify that you are a human"
>Please verify that you are a human</label>
<div
class
=
"input-group col-md-3 col-md-offset-1 col-xs-1"
>
<div
class
=
"input-group pull-left"
>
@
using
(Html.BeginForm(
"FormSubmit"
,
"Home"
, FormMethod.Post))
{
<div
class
=
"g-recaptcha"
data-sitekey=
"6LezHOIUAAAAANq0FvFWWbvBlb6Vc1Y2YwnixVqJ"
>
</div>
}
</div>
</div>
</div>
<hr />
<div
class
=
"row"
>
<label
for
=
"Dietary Requirements"
>Dietary Requirements</label>
<div
class
=
"input-group col-md-offset-3 col-sm-6 col-xs-6"
>
<div
class
=
"input-group pull-left"
>
</div>
</div>
</div>
</form>
<hr/>
<!--Submit form button to allow insert data to db-->
<div
class
=
"form-group"
>
<hr/>
<button type=
"button"
class
=
"btn btn-primary"
>Submit</button>
</div>
}
</div>
</div>
</div>
</center>
<!----Javascript
for
form validation including recapture on Google-->
<script src=
"https://www.google.com/recaptcha/api.js"
type=
"text/javascript"
>
</script>
Reply
Answers (
1
)
Consuming Web API with Bearer Authentication Token
final project in unv and i need help form good pepole