Part 12 Creating a view to insert data using mvc

preview_player
Показать описание
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Slides

All ASP .NET MVC Text Articles

All ASP .NET MVC Slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

In this video we will discuss, creating a view to insert a new employee into the database table tblEmployee. Please watch Part 11, before proceeding with this video.

We want to present the end user with a form to enter data.

Copy and paste the following "Create" action method, in EmployeeController class.
[HttpGet]
public ActionResult Create()
{
return View();
}

Please note that, the method is decorated with "HttpGet" attribute. This makes this action method to respond only to the "GET" request.

Now let's add a "Create" view. To do this, right click on the "Create" action method and select "Add View" from the context menu. Set
1. View name = "Create"
2. View engine = "Razor"
3. Select "Create Strongly-typed view checkbox
4. Select "Employee" class, from "Model class" dropdownlist
5. Scaffold Template = Create
6. Click "Add" button

@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

Run the application and navigate to the following URL

Click on "Create New" link. You will be naviaged to the following URL

A form with textboxes to add a new employee is rendered. For employee "Gender" it is ideal to have a dropdownlist instead of a text box.

Run the application and notice that, a dropdownlist is now displayed for "Gender".

If you click on "Create" button, you will get an error message stating - The resource cannot be found. This is because we donot have the "Create" controller action method that can handle HTTPPost request. We will discuss fixing this in our next video.
Рекомендации по теме
Комментарии
Автор

Hi, sure we will be discussing. please stay tuned. If you want to receive email alerts, when new videos are uploaded, please feel free to subscribe to my youtube channel.

Csharp-video-tutorialsBlogspot
Автор

your voice clarity.. and ur presentation style is awosme....

shra
Автор

How can say ❤️ hearty thanks to Kudvenkat sir, ... Giving such an in depth lessons for us, I am just watching every advertisement coming on your video sir. 🙏. You are giving really good coaching to us. Thank you so much sir.

rajareddyanapareddy
Автор

Thank u sir so much ...your videos helped me to get a job in IT of

kavithavishwanath
Автор

You really are in love with Arial Font, lol. amazing tutorials many thanks

hansdeep
Автор

I didn't met you still, But u helped me to get a good job.Thanks a lot. What a explanation and clarity in voice? hats off venkat. With love from tamilnadu.

SanthanamV
Автор

Hi Ricky, this is discussed in asp.net tutorial. In the description of this video, I have included the link for ASP .NET, C#, and SQL Server playlists. All the videos are arranged in logical sequence in these playlists, which could be useful to you. Please share the link with your friends who you think would also benefit from them. If you like these videos, please click on the THUMBS UP button below the video. For email alerts, when new videos are uploaded, you may subscribe to my channel.

Csharp-video-tutorialsBlogspot
Автор

Hi Harika, the scaffold templates help us generate most of the code. After the code is generated you can tweak it the way you want to meet user requirements.

Csharp-video-tutorialsBlogspot
Автор

You are Gem! Venkat ..Keep up the good work

shri
Автор

really your all vedios are really help ful for me.... tq tq tq soooo much...

shra
Автор

Thank you very much, Venkat ! You're a reference for me !

kamdemkakengne
Автор

have a great day, nice style, awesome

imranbhatti
Автор

Sure, we will discuss about jQuery as well.

Csharp-video-tutorialsBlogspot
Автор

Venkata cannot stand other than Arial Fon!! Hehe. Just Kidding. Amazing Tutorials! Keep up the great work.

testpayman
Автор

I appreciate your work, thank you from my heart

mohamadalibrahim
Автор

Hi Sir,
Its a great Experience to watch your videos which gives a complete information about Topics. Thanks for that.
Sir, I had a view for Registration of new users. Now I want to insert the details from this view to database with code behind.
Can u

Thanks & Smile

rickyr
Автор

kudvenkat There's just one thing i did not understand, how can you order the button to execute "Create" action (the one with POST)? in the html it only says type=submit, value=create. What would happen if i had more than one button in this case?
Thank you for your videos, they've helped me a lot

andreasellerbrock
Автор

Hello boss, your videos helps me a lot.. I'm very new in asp.net and c#.. Not more than a month..Sir, could u show how to add calendar pop-up while selecting date using Razor View Engine(.cshtml)???.. I found the way how to do it in ASPX, but not in Razor. I'm really appreciate it. TQ

azharjamil
Автор

Hi Venkat, will you be teaching us JQuray to display error later on MVC.

And thanks for this tutorial.

jangear
Автор

Hi, SelectListItem, has got "Selected" property which is false by default. If you want female item to be selected, set selected property of this item to true as shown below.

@Html.DropDownList("Gender", new List[SelectListItem]
{
new SelectListItem { Text = "Male", Value="Male" },
new SelectListItem { Text = "Female", Value="Female", Selected = true }
}, "Select Gender")
=] model.Gender)

Csharp-video-tutorialsBlogspot
join shbcf.ru