Geeks With Blogs

News

Microsoft MVP


Moderator at CodeASP.NET


Quiz Master




free counters
Free counters
Added on January 19,2012


Follow Me @vmsdurano

A bit About Me



Disclaimer
The opinions expressed herein are my own personal opinions and does not represent the opinions of my employers. Nor does it represent the opinion of my dog, because I don’t have one.


Vinz' Blog (ProudMonkey) "Code, Beer and Music ~ my way of being a programmer"

In this article I'm going to demonstrate how to create a simple sign-up form using ASP.NET MVC 3. So basically in this demo you will learn the following:

How to insert data to the database with Entity Framework
How to validate the Form using Data Annotations
How to Authenticate users after sign up using FormsAuthentication

Note that before you continue reading this article be sure that you have the basic understanding about ASP.NET MVC in general. You can refer the following links below to learn more about ASP.NET MVC:

http://msdn.microsoft.com/en-us/library/dd381412%28VS.98%29.aspx
http://www.asp.net/mvc/whatisaspmvc



STEP 1. Adding a new ASP.NET MVC project

Let's go ahead and fire up Visual Studio 2010 and then select File -> New Project -> ASP.NET MVC 3 Web Application. See the screen shot below for more clearer view:



Now click OK and on the next form select Empty Template -> select Razor as the View engine and then click OK to generate the default files.


STEP 2: Setting up the Model

In this demo, I'm going to use Entity framework as our Data Access mechanism sothat we can program against the conceptual application model instead of progamming directly against  our database.

Add the following folders under the Models folder:

    DB
    ObjectManager
    ViewModel

The application structure would like something like below:




We will create our Entity Model (EDMX) in the DB folder. To do this right click on the "DB" folder and select Add -> New Item -> Data -> ADO.NET Entity Data Model.



Noticed that I named the entity as "SampleModel" just for the purpose of this demo. You may want to name it to a more appropriate name based on your requirements but for this example let's just use "SampleModel". Now click Add to continue and on the next step select "Generate from database" and click Next. On the next step you can connect or browse to the database that you want to use in the application and test the connection string by clicking on the "Test Connection" button and if it succeeds then you can continue by clicking OK and then Next.

Note that in this example I created a simple database called "DeveloperReport.mdf" and added it into the application's App_Data folder and use it as our database. See the screen shot below:




On the next step we can add the table(s), views or stored procedures that we want to use in the application by selecting the checkbox. See below screenshot:



Noticed that I've only selected the "SysUser" table. This is because we are going to use this table for doing insert and we don't need anything else. Now click on Finish button to generate the entity model for you. See the screenshot below:



What happend there is that EF will automatically generates the Business object for you within the Entity Data Model(EDM) that we have just created and let you query against it.The EDM is the main gateway by which you retrieve objects from the database and resubmit changes.


STEP 3: Adding the ViewModel Class

Just to recap Entity Framework will generate the business objects and manage Data Access within the application. As a result, the class SysUser is automatically created by EF and it features all the fields in the database table as properties of the class.

I don't want to use this class direclty in the View so I decided to create a separate class that just holds the properties I need in the View. Now let's add a the UserView class by right-clicking on the "ViewModels" folder then select Add -> Class. Here's the code block for the "UserView.cs" class.

using System.ComponentModel.DataAnnotations;

namespace MVCDemo.Models.ViewModels {
    public class UserView {
        [Required]
        [Display(Name = "First Name")]
        public string FirstName { get; set; }

        [Required]
        [Display(Name = "Last Name")]
        public string LastName { get; set; }

        [Required]
        [Display(Name = "Contact Number")]
        public string ContactNumber { get; set; }

        [Required]
        [Display(Name = "Login ID")]
        public string LoginID { get; set; }

        [Required]
        [Display(Name = "Password")]
        public string Password { get; set; }
    }
}



Noticed that I added the Required and DisplayName attributes for each property in the UserView class. This attributes is called Data Annotations. Data annotations are attribute classes that live in the System.ComponentModel.DataAnnotations namespace that you can use to to decorate classes or properties to enforce pre-defined validation rules.

I'll use this validation technique because I want to keep a clear separation of concerns by using the MVC pattern and couple that with data annotations in the model, then your validation code becomes much simpler to write, maintain, and test.

For more information about Data Annotations then you can refer this link: http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.aspx. And of course you can find more examples about it by doing a simple search at google /bing


STEP 4: Adding the UserManager Class

The next step that we are going to do is to create the User manager class that would handle the (CRUD operations) create,update,fetch and delete operations of a certain table. The purpose of this class is to separate the actual data opertions from our controller and to have a central class for handling insert,update,fetch and delete operations. But please note that in this example I'm only be doing the insert part in which a user can add new data from the View to the database. I'll talk about how to do update,fetch and delete with MVC in my next article. So this time we'll just focus on the insertion part first.

Now right click on the "Model" folder and add a new class by selecting Add -> Class and since we are going to manipulate the SysUser table then we will name the class as "UserManager". Here's the code block for the "UserManager.cs" class:

using System.Linq;
using MVCDemo.Models.DB;
using MVCDemo.Models.ViewModels;

namespace MVCDemo.Models.ObjectManager {
    public class UserManager {

        private DeveloperReportEntities dre = new DeveloperReportEntities();

        public void Add(UserView user) {
            DB.SysUser sysUser = new DB.SysUser();
            sysUser.SysUserLoginID = user.LoginID;
            sysUser.SysPassword = user.Password;
            sysUser.FirstName = user.FirstName;
            sysUser.LastName = user.LastName;
            sysUser.ContactNumber = user.LastName;

            dre.AddToSysUsers(sysUser);
            dre.SaveChanges();
        }

        public bool IsUserLoginIDExist(string userLogIn) {
            return (from o in dre.SysUsers where o.SysUserLoginID == userLogIn select o).Any();
        }
    }
}



STEP 4: Adding the Controllers

Since our model is already set then let's go ahead and add the "AccountController". To do this just right click on the "Controllers" folder and select Add -> Controller. Since our aim is to create a simple sign-up form then name the controller as "AccountController" and then click Add to generate the "AccountController" class for you.

Now here's the code block for the "AccountController":

using System.Web.Mvc;
using System.Web.Security;
using MVCDemo.Models.ViewModels;
using MVCDemo.Models.ObjectManager;

namespace MVCDemo.Controllers
{
    public class AccountController : Controller
    {
        // GET: /Account/SignUp
        public ActionResult SignUp() {
            return View("SignUp");
        }

        // POST: /Account/SignUp
        [HttpPost]
        public ActionResult SignUp(UserView user) {
            try {
                if (ModelState.IsValid) {
                    UserManager userManager = new UserManager();
                    if (!userManager.IsUserLoginIDExist(user.LoginID)) {
                        userManager.Add(user);
                        FormsAuthentication.SetAuthCookie(user.FirstName, false);
                        return RedirectToAction("Welcome", "Home");
                    }
                    else {
                        ModelState.AddModelError("", "LogID already taken");
                    }
                }
            }
            catch {
                return View(user);
            }

            return View(user);
        }
    }
}


The AccountController has two main methods. The first one is the "SignUp" which returns the "SignUp.cshtml" View. The second one also named as "SignUp" but it is decorated with the "[HttpPost]" attribute. This attribute specifies that the overload of the "SignUp" method can be invoked only for POST requests.

The second method is responsible for inserting new entry to the database and automatically authenticate the users using FormsAuthentication.SetAuthCookie() method. this method creates an authentication ticket for the supplied user name and adds it to the cookies collection of the response, or to the URL if you are using cookieless authentication. After authenticating, we then redirect the users to the Welcome.cshtml page.

Now add another Controller and name it as "HomeController". This controller would be our controller for our default page. We will create the "Index" and the "Welcome" View for this controller in the next step. Here's the code for the "HomeController" class:

using System.Web.Mvc;

namespace MVCDemo.Controllers
{
    public class HomeController : Controller
    {
        // GET: /Home/
        public ActionResult Index()
        {
            return View();
        }

        [Authorize]
        public ActionResult Welcome() {
            return View();
        }

    }
}


Noticed that we have two ActionResult method in the "HomeController". The "Index" method serve as our default redirect page and the "Welcome" method will be the page where we redirect the users after they have successfully registered. We also decorated it with the "[Authorize]" attribute so that this method will only be available for the logged-in users.

STEP 5: Adding the Views

First let's add the following folders below under the "Views" folder:

    Home
    Account

Note: The reason for this is that the folder name should match the name of the Controllers you've created. So if you have HomeController then you should have a "Home" folder within your View.

Now under the "Home" folder add a new View. To do this just right click on the "Home" folder and select Add -> View. Name the view as "Index" and click Add to generate the Web Page (.cshtml). Here's the mark-up of the Index.cshtml:

@{
    ViewBag.Title = "Welcome";
}

<h2>Welcome</h2>

@Html.ActionLink("Click here to sign-up", "SignUp", "Account")


As you can see there's no fancy about the mark-up above except that it contains the ActionLink which redirect you to the "SignUp" view within the "Account" folder. Now add again another View under the "Home" folder and name the view as "Welcome". The reason why we add the Welcome.cshtml view is because we will redirect the user in this page after they successfully signed up and nothing more. Here's the mark-up of the Welcome.cshtml:

@{
    ViewBag.Title = "Welcome";
}

<h2>Hi <b>@Context.User.Identity.Name</b>! Welcome to my website!</h2>

Now under the "Account" folder add a new view and name it as "SignUp" and check the checkbox that says "create a strongly-typed views and in the Model class dropdownlist select "UserView" and then in the Scaffold template select "Create" and finally click Add to generate the Web Page for you. Take a look at the screen shot below for more clearer view of what I am talking about:





And here's the generated mark up of the SignUp.cshtml:

@model MVCDemo.Models.ViewModels.UserView

@{
    ViewBag.Title = "SignUp";
}

<h2>Sign-Up</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>UserView</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.FirstName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FirstName)
            @Html.ValidationMessageFor(model => model.FirstName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.LastName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LastName)
            @Html.ValidationMessageFor(model => model.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ContactNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ContactNumber)
            @Html.ValidationMessageFor(model => model.ContactNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.LoginID)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LoginID)
            @Html.ValidationMessageFor(model => model.LoginID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Password)
        </div>
        <div class="editor-field">
            @Html.PasswordFor(model => model.Password)
            @Html.ValidationMessageFor(model => model.Password)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Return to Home page","Index", "Home")
</div>


The mark-up above is a strongly-type view. This strongly typed approach enables better compile-time checking of your code and richer IntelliSense in the Visual Studio editor. By including a @model statement at the top of the view template file, you can specify the type of object that the view expects. In this case it uses the MVCDemo.Models.ViewModels.UserView.

The View structure would like something like below:


STEP : Running the Application

Running the page will give you the following outputs:

On initial load:



After clicking on the Sign-Up link:



Sample screen shot that shows the validation



Completing the form



After successfully registered

 

That's it! I hope someone find this post useful!

Posted on Friday, June 3, 2011 8:44 PM ASP.NET | Back to top


Comments on this post: ASP.NET MVC 3: Creating a Simple Sign-Up Form

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
as always...great article from a great mind...

Left by mbangoy on Jun 10, 2011 2:33 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
super post
Left by vinoth on Jun 27, 2011 2:37 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
great code from a genius monkey!
Left by rregual on Jul 15, 2011 7:50 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Hi,

Thanks for the great code, but i was hoping you can help me on this. I am working on mine school project and i require to use asp to do my website out.

Now my question is, is it possible when a user register themselves and the form will automatically write to two table during the registration

Please advice me on this. Thanks.
Left by Willy on Jul 19, 2011 4:40 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Hi.
Thanks so much for this example. Just what I needed to start to understanding this MVC. Everything in this article goes ok except last step: When I add the View in the Accounts folder I found that the <Model class> drop-down box is empty, and I can't mark <Scaffold template> to "Create" (It appears uneditable and "Empty" as value) ¿Do you know what could it be the cause of this?
Thanks in advance.
Left by GinSheng on Aug 10, 2011 1:02 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Uppss.

My fault. I forgot to compile the project before. Now it works.

Regards.
Left by GinSheng on Aug 10, 2011 1:10 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
nice and simple. I am still trying to find the true benefit of complicating something that using takes a few lines of code..I still can't wrap my head around why I would go thru all the extra things of MVC.
Left by Ustes G on Sep 10, 2011 6:18 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Hi! Nice post. Thank you very much!

I could see a minimal mistake here:
.
.
sysUser.LastName = user.LastName;
sysUser.ContactNumber = user.LastName;
.
.

Left by Francisco Gileno Oliveira on Sep 10, 2011 11:56 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Thanks a lot for such a nice article..
Left by Arun on Oct 12, 2011 6:02 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
this is great stuff, thanks for sharing with us. It's help me lot and this link
http://www.mindstick.com/Articles/6f3bb3c6-d195-487b-8b82-244bb417b249/?Model%20classes%20with%20Entity%20Framework%20in%20MVC
also helped me in completing my project.

Thanks !!!
Left by JaypeeHuda on Oct 12, 2011 9:40 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Its a nice post.
Left by shrinivas on Nov 09, 2011 6:34 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
This app works on IIS7 Express. But when set the project properties to local IIS Web Server and try to run app, get:

Directory Listing Denied
This Virtual Directory does not allow contents to be listed.

What needs to be done to let app run on local IIS Web Server?
Left by aaaaaaum on Nov 26, 2011 11:04 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
If MVC3 app works on IIS7 Express but not on IIS7 Server, then see:

http://www.tikalk.com/net/aspnet-mvc-3-extensionless-urls-iis-7-classic-mode

and

http://support.microsoft.com/kb/980368

Left by aaaaaaum on Nov 26, 2011 3:46 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Hi.. Thanks for this post..
I have one requirement that cascading a dropdown based on the another drop as well displaying the text editor field later. Now information which entered in the editable field should be saved into url in XML for further purpose. can any help me out with example. its urgent task for me .
Thanks in advance
Left by kris on Dec 09, 2011 8:04 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
why is my create not working? after i filled up everything and click create nothing happens...
Left by andreo on Dec 15, 2011 6:21 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
I have implemented the above sample application as per instruction, but I have throwing following exception in AccountController.cs file.
[HttpPost]
public ActionResult SignUp(UserView user)
{
try{
-----
------
}
catch{
return View(user);
}
}
"Unable to update the EntitySet 'SysUser' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation."

Please help me on this ASAP.
Left by Faizal on Dec 21, 2011 2:56 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Thanks a ton for the post ..
Left by Krish on Dec 22, 2011 10:08 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
I have implemented the above sample application as per instruction, but I have throwing following exception in AccountController.cs file.

Unable to update the EntitySet 'Register' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

If anybuddy know how to handle these exception pls let me know ASAP.
Left by Pradnya on Jan 17, 2012 8:48 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
I resloved the exception like this, Right click on the edmx file, select Open with, XML editor
Locate the entity in the edmx:StorageModels element
Remove the DefiningQuery entirely
Rename the store:Schema="dbo" to Schema="dbo" (otherwise, the code will generate an error saying the name is invalid)
Remove the store:Name property
--Pradnya
Left by pradnya on Jan 19, 2012 6:29 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
I try to Create the same in the above example. Here when i Click Button Signup event is not Fired. also when i give HttpPost an error occured
"Type or NameSpace httppost attribute could not be Found ".
i am using vs 2008, Framework 3.5 .
kindly help me to resolve the same.
Left by Abhilash Babu on Jan 26, 2012 8:42 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...

The project is built on top of ASP.NET 4.0 and it uses MVC 3. You're probably referencing the wrong version System.Web.Mvc . Check the reference to that, and if it's wrong, remove it and re-add the correct version.
Left by Vinz on Jan 26, 2012 10:02 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Thanks for these explanations very informative abopiut technical things i didnot know. Sure i will come agian to read your instructions ! Long life to Vinz Blog !
Left by bourse de paris on Feb 04, 2012 6:22 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
agar kisi ko bhi developing ke bare me kuch bhi puchna ho to mujhse contack karo because i am the king of asp.net developer bachche thod mujhse padh liya karo
Left by King of developer on Feb 07, 2012 7:09 PM

# adding two values iby using asp.netmvc3 with out database
Requesting Gravatar...
please send reply fast
Left by sarvesswar on Feb 18, 2012 3:33 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
@model MVCDemo.Models.ViewModels.UserView

The above code in SignUp.cshtml not working..It is throwing an error.Can any one please respond.
Left by Santosh Kumar on Feb 21, 2012 9:58 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Man! That's awesome!

I'm new with ASP.NET MVC and I looked for such a simple description and example of Authentication for days.

Thank you so much!
Left by Andrew on Feb 23, 2012 1:39 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
i want to create a field gender with value: --select--, male, female by dropdowlist. how do create?
Left by Pham Trung Tin on Mar 05, 2012 6:17 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
how do integrate the role security with this.
Left by shelby poston on Mar 07, 2012 6:47 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Error show:The type or namespace name 'DeveloperReportEntities' could
not be found (are you missing a using directive or an assembly
reference?)
how can i solve this problem, could u please give any solution
Left by pankaj on Mar 24, 2012 6:49 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
nice post. it is very helpful
Left by anusha on Apr 04, 2012 2:38 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
very useful post for me............
Left by mahesh on Apr 13, 2012 7:43 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Thanks for nice post.

Some of the images are not loading please add them.
Left by rama charan on Apr 24, 2012 1:48 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
I am having a problem with the sysUser part of this tutorial. It does not appear anywhere underneath the table section when I create the database. In fact, none of what you show is there, is there something I am missing?
Left by tom on Apr 28, 2012 1:46 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Good one....
Left by Pavan on May 02, 2012 8:39 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Hi,

I would like to tell that, in your code you used like this

" dre.AddToSysUsers(sysUser);
dre.SaveChanges(); "
If we going like this, the data which we entered is not going to store in DB.

so please change code like this

DBContextName.TableName.AddObject(objectname);
DBContextName.savechanges();

i.e
dre.SysUsers.AddObject(sysUser);
dre.SaveChanges();

Now it will be stored in DB
Left by Pavan on May 02, 2012 8:44 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Hi

Good Post. i need insert,edit,Update samples for same this.
Left by Jayakumar on May 14, 2012 3:22 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Gr8 effort.. and very good article for begineers...
Left by Dipesh on Jul 05, 2012 2:27 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
{"Invalid column name 'SysUserLoginID'.\r\nInvalid column name 'SysUserLoginID'."}
i m getting such error.. after click the sign up the page doesnt change

anyone know whats wrong?
Left by andy on Jul 09, 2012 9:22 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Im getting the same error as andy :
{"Invalid column name 'SysUserLoginID'.\r\nInvalid column name 'SysUserLoginID'."}

Any ideas? anyone? Tnx
Left by mc on Jul 22, 2012 5:32 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
andy,

My issue was the db Context file. The entry for the mappings was missing. This fixed my issue.
Left by mc on Jul 22, 2012 9:20 AM

# HELP- ME ERROR COME THIS LINE
Requesting Gravatar...
public bool IsUserLoginIDExist(string userLogIn) {
return (from o in dre.SysUsers where o.SysUserLoginID == userLogIn select o).Any();
}

Dont Convert implicit datatype
Left by Thenrajan on Sep 23, 2012 3:20 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
this blog is really very nice. but i need some help .
. i am new in mvc3 and i want to insert record using textbox and view record in gridview in single .cshtml Page .

2.gridview contain edit and delete button when click in edit button then record fill in textbox after that we can update record and when click in delete button then record should be delete from database.
how to do this..
Left by rabindra on Oct 09, 2012 5:45 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
I am new to this
Everything works great up to the point of "submit". it stays on the same "Sign Up" page without advancing to the Welcome screen. When I view the HTML source I see the form tag's action equals "/Account/SignUp" ; should say "/home/Welcome" instead? Where is the form tag produced or what am I missing?
thanks
Left by Craig on Oct 19, 2012 4:15 AM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Very HelpFull Article.............its Great
Left by Salman on Nov 05, 2012 1:52 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Very nice Article


Help good
Left by Ram on Nov 05, 2012 6:01 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
nice article.......
Left by Akhilesh Soni on Dec 26, 2012 8:54 PM

# ASP.NET Developer
Requesting Gravatar...
Asp.Net provides inbuilt signup and signin page.it's easily working without coding.thanks for sharing worth information.
Left by GriffinDorsey on Feb 06, 2013 2:07 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Sir, I have a question. When I tried this tutorial and run it, mine does not redirect to the page where it says "Hi(user)! Welcome to my website" ....I just get stuck at the sign up page and when I click Create nothing happens. I do not even know if the user I created was really created. Pls help. I am new to asp.net
Left by Aldrich Lim on Feb 09, 2013 12:46 PM

# re: ASP.NET MVC 3: Creating a Simple Sign-Up Form
Requesting Gravatar...
Thanks for your post.I am new in MVC . This post is really helpfull.
Left by Raju Hasan on Feb 16, 2013 2:54 AM

comments powered by Disqus

Copyright © Vincent Maverick Durano | Powered by: GeeksWithBlogs.net | Join free