Registration Form & Bind Grid view Using MVC
Step 1st :- Use SQL Server
-- Create Table
CREATE TABLE UserNewReg
(
Name varchar(50),
Gender varchar(50),
EmailId varchar(50) primary key ,
Password varchar(50),
MobileNo varchar(50)
);
Step 2nd :- Use Visual Basic 2013
--- Create Emplty MVC Project (VijayMVCWebApp)
1--- First Create Model Class
2----Second Add Validation (UserNewReg.cs)
public partial class UserNewReg
{
[Required(ErrorMessage = "Enter Name.")]
public string Name { get; set; }
[Required(ErrorMessage = "Enter Gender.")]
public string Gender { get; set; }
[Required(ErrorMessage = "Enter Email-id.")]
[EmailAddress(ErrorMessage = "Invalid email address.")]
public string EmailId { get; set; }
[Required(ErrorMessage = "Enter Password.")]
public string Password { get; set; }
[Required(ErrorMessage = "Enter MobileNumber.")]
public string MobileNo { get; set; }
}
3---- Add Controller ("HomeContoller")
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using VijayMVCWebApp.Models;
namespace VijayMVCWebApp.Controllers
{
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
//Create Object of DataBase
DotNetDBEntities db = new DotNetDBEntities();
//For New Registration
public ActionResult NewUserAdd()
{
return View();
}
//Save New USer
[HttpPost]
public ActionResult NewUserAdd(UserNewReg emp)
{
db.UserNewRegs.Add(emp);
db.SaveChanges();
return View();
}
//Show User GridView
public ActionResult UserGridList()
{
return View(from user in db.UserNewRegs.Take(10)
select user );
//return View();
}
}
}
Note :- Create View as exaple As below Image
eg.:-Code of View(Bind Gridview) UserGridList.cshtml
@model IEnumerable<VijayMVCWebApp.Models.UserNewReg>
@{
ViewBag.Title = "UserGridList";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>UserGridList</h2>
<table cellpadding="0" cellspacing="0" class="table">
<tr>
<th>Name</th>
<th>Gender</th>
<th>EmailId</th>
<th>Password</th>
<th>MobileNo</th>
</tr>
@foreach (var user in Model)
{
<tr>
<td>@user .Name</td>
<td>@user .Gender</td>
<td>@user .EmailId</td>
<td>@user .Password</td>
<td>@user .MobileNo</td>
</tr>
}
</table>
-----------------------------------------------------------------
OUTPUT
-----------------------------------------------------------------
1:- Registration form with validation
2:-User Bind Gridview
Mast
ReplyDeleteThanks
ReplyDeleteIt is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
ReplyDeleteangularjs Training in bangalore
angularjs Training in btm
angularjs Training in electronic-city
angularjs Training in online
angularjs Training in marathahalli
A universal message I suppose, not giving up is the formula for success I think. Some things take longer than others to accomplish, so people must understand that they should have their eyes on the goal, and that should keep them motivated to see it out til the end.
ReplyDeletepython training in pune | python training institute in chennai | python training in Bangalore
It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command
ReplyDeleteJava training in Indira nagar | Java training in Rajaji nagar
Java training in Marathahalli | Java training in Btm layout
This is very good content you share on this blog. it's very informative and provide me future related information.
ReplyDeleteData Science Training in Indira nagar | Data Science Training in Electronic city
Python Training in Kalyan nagar | Data Science training in Indira nagar
Data Science Training in Marathahalli | Data Science Training in BTM Layout
I have been searching for this information and got to know now. Thanks to the admin for sharing this blog.
ReplyDeleteBest English Classes in Bangalore
Best English Coaching Classes in Bangalore
English Speaking Classes in Bangalore
Best Spoken English Training in Bangalore
Spoken English Classes in Bangalore
Spoken English Class in Bangalore
Spoken English Training in Bangalore
In the beginning, I would like to thank you much about this great post. Its very useful and helpful for anyone looking for tips. I like your writing style and I hope you will keep doing this good working.
ReplyDeleteaws training in bangalore
AWS Training
Aws Certification in Chennai
best aws training in bangalore
Best AWS Training in Chennai
AWS Training in Chennai
Very nice blog, Thank you for providing good information.
ReplyDeleteAir hostess training in Chennai
Air Hostess Training Institute in chennai
air hostess course fees structure in chennai
air hostess training academy in chennai
I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
ReplyDeletedevops online training
aws online training
data science with python online training
data science online training
rpa online training
Resources like the one you mentioned here will be very useful to me ! I will post a link to this page on my blog. I am sure my visitors will find that very useful.
ReplyDeleteAWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery
The content of this blog was explained very well. concepts are very clearly understandable. easy to understand every concept.
ReplyDeleteData Science Training Course In Chennai | Data Science Training Course In Anna Nagar | Data Science Training Course In OMR | Data Science Training Course In Porur | Data Science Training Course In Tambaram | Data Science Training Course In Velachery
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had
ReplyDeletenot encountered such a step like this.
Java training in Chennai
Java training in Bangalore
Java training in Hyderabad
Java Training in Coimbatore
Java Online Training
Thanks for sharing the information, Plz keep sharing on. Excellent blog.
ReplyDeleteangular js training in chennai
angular js training in annanagar
full stack training in chennai
full stack training in annanagar
php training in chennai
php training in annanagar
photoshop training in chennai
photoshop training in annanagar
Wow i amazed with your blog,
ReplyDeleteThanks to share with us,
angular js training in chennai
angular js training in porur
full stack training in chennai
full stack training in porur
php training in chennai
php training in porur
photoshop training in chennai
photoshop training in porur
This post is so interactive and informative.keep update more information...
ReplyDeleteSpoken English Classes in Velachery
Spoken English Classes in Chennai
kralbet
ReplyDeletebetpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
betmatik
DCGHB
If you are new user in any site then register after that login. To do it, you can use and access. Registration is possible to use mvc. Future Digital Marketing Options show to make software right. Error can be solved by redirection.
ReplyDelete