http://csharp-video-tutorials.blogspo...
Slides
http://csharp-video-tutorials.blogspo...
All ASP .NET MVC Text Articles
http://csharp-video-tutorials.blogspo...
All ASP .NET MVC Slides
http://csharp-video-tutorials.blogspo...
All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenka...
All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatAr...
In this video we will dsicuss editing a model in mvc. Please watch Part 16, before proceeding.
Step 1: Copy and paste the following "Edit" controller action method in "EmployeeController.cs" file.
[HttpGet]
public ActionResult Edit(int id)
{ EmployeeBusinessLayer employeeBusinessLayer = new EmployeeBusinessLayer(); Employee employee = employeeBusinessLayer.Employees.Single(emp =] emp.ID == id); return View(employee);
}
Please note:
1. This method is decorated with [HttpGet] attribute. So this method only responds to HTTP get request when editing data.
2. The "Edit" action method also receives "id" of the employee that is being edited. This "id" is used to retrieve the employee details.
3. The employee object is passed to the view
Step 2: Add "Edit" view
a) Right click on the "Edit" controller action method, and select "Add view" from the context menu
b) Set View name = Edit View engine = Razor Select "Create a strongly-typed view" check box Model class = "Employee" Scaffold template = "Edit" Finally click "Add" button
c) This should add "Edit.cshtml" to "Employee" folder in "Views" foolder
d) Delete the following scripts section that is present at the bottom of "Edit.cshtml" view
@section Scripts
{ @Scripts.Render("~/bundles/jqueryval")
}
Run the application and navigate to http://localhost/MVCDemo/Employee/Index. This page should list all the employees. Click on "Edit" link. The "Edit" page should display the details of the "Employee" being edited. Notice that, by default "textboxes" are used for editing. It is ideal to have a dropdownlist for gender rather than a textbox. To achieve this. make the following changes to "Edit.cshtml"
REPLACE THE FOLLOWING CODE
@Html.EditorFor(model =] model.Gender)
@Html.ValidationMessageFor(model =] model.Gender)
WITH
@Html.DropDownList("Gender", new List[SelectListItem] { new SelectListItem { Text = "Male", Value="Male" }, new SelectListItem { Text = "Female", Value="Female" } }, "Select Gender")
@Html.ValidationMessageFor(model =] model.Gender)
Run the application. Edit an employee, and notice that a DropDownList is used for gender as expected. Post the form by clicking on "Save" button. We will get an error stating - The resource cannot be found. We will discuss fixing this in our next video.
asp.net core docker Part 17 Editing a model in mvc | |
384 Likes | 384 Dislikes |
190,921 views views | 524K followers |
Education | Upload TimePublished on 16 May 2013 |
Related keywords
update mysql,wcf vs web api,ado.net core,sql server management studio,webkinz,webadvisor,craigslist nj,wcf one piece,asp.net core 3,ajax players,weber grill parts,webtoon,tutorials by hugo,csharp corner,mvc design pattern,asp.net machine account,servers for minecraft,asp.net core dependency injection,ado.net tutorial,editorial writing,model t,update csgo,model s,services angular,ajax ontario,controller spring,update angular cli,asp.net mvc tutorial,asp.net cos'è,csharp assembly,edit photo online,tutorialspoint python,sql join,services briefcase,asp.net core web api,data entry,ajax jquery,wccftech,craigslist ny,edith glasses,data warehouse,asp.net zero,csharp foreach,server memes,sql date format,edit video,services online,chase,controller pioneer,model cars,controller php,update select,serverless architecture,server resume,data science,wcf c#,server books,tutorialspoint javascript,mvcc connect,ado.net mysql,services technologies gps,data scientist,controller pak n64,editorial cartooning,ajax deadpool,server jobs,modeling agencies,model x,editorial,cvs,website,model y,mvc tutorial,costco hours,wcf service application,controlleradvice,controller angularjs,controller ableton,tutorialspoint spring,serverless,wcf soap,contrôleur dj,editoryal,editing apps,wcf cat,wcf test client,cool math games,model o mouse,services & training hse colombia sas,servicestack,citibank,asp.net core identity,sql union,ajax parking,sql database,asp.net core logging,updates were rejected because the tip of your current branch is behind,mvconnect,asp.net guida,cunyfirst,wcf nba,csharp download,wcfi foundation,csharp online,wcf authentication,model s tesla,tutorials near me,http://asp.net,server 2019,ado.net descargar,web of dreams,chernobyl,serverminer,ajax cleaner,model t ford,ado.net visual studio 2019,webassign,ado.net vs entity framework,data star trek,data lake,ado.net visual studio 2017,csharp list,sql like,asp.net mvc,asp.net core tutorial,sqlite,wcfm,ajax roster,mvc architecture,http://ado.net,modelo negra,update node,asp.net core mvc,ajax soccer,server hosting,update inner join,data scientist salary,update viajes,update postgresql,controller ps4,wcfi,edit pdf,updated,ajax dish soap,controller ps4 pc,capital one,server rack,tutorialspoint html,data mining,csharp interface,craigslist,webroot,tutorialspoint reactjs,ajax request,wcf dragon ball,asp.net core 2.2,tutorialspoint python 3,sql developer,webster,services transmission company sas,update windows 10,sql group by,asp.net core signalr,services manager,mvc framework,ajax paving,mvc near me,data analysis,update traduccion,edith tiempo,tutorialspoint spring boot,editing,mvc map,csharp online compiler,update chrome,update from,editing pictures,asp.net download,sql between,modeling clay,data analyst salary,ado.net c# pdf,wcf 2019 nba,services tag dell,update oracle,editorial writing example,csharp switch,ado.net ventajas y desventajas,csharpstar,wcf tutorial,modeling,tutorialspoint,controller for all,controller pro switch,ajax meaning,csharp-video-tutorials.blogspot,tutorials dojo,csharp string format,central park 5,ado.net c#,asp.net core github,controller chaos,server status,ajax fc,server jobs nyc,asp.net core swagger,sql formatter,credit karma,services group,server error in '/' application,data entry jobs,edit pdf online,services windows,asp.net core 3.0,http://controller.access.network,sql injection,wcf ria services,tutorialspoint c#,calculator,ado.net entity data model,sql insert,data analytics,tutorialspoint tableau,services google play apk,model engine kits,sqlyog,asp.net core 3 release date,sql server,server job description,tutorials by a,update bios,servicenow,webcam,mvc hours,webmd symptom,controllership,csharp array,csharp enum,ajax call,asp.net core 2. guida completa per lo sviluppatore,asp.net core,server pro,controller firmware revision 2.10.00 embedded media manager failed media attach,server status ffxiv,model x tesla,webcrims,cheap flights,asp.net core hosting,services sas,update java,model a ford,update npm,modells,tutorialspoint java,tutorialspoint java compiler,datadog,webmd,editing software,csharp to json,college football,ado.net dataset,csharp dictionary,editor,cnn,website builder,tutorialspoint sql,asp.net web api,server side rendering,weber grills,sql server 2017,mvc nj,tutorialspoint spark,data breach,ado.net oracle,asp.net core download,csharp to vb.net,webster bank,webstaurant,datacamp,tutorialsystems,ajax post,services fms publish announcement,services.msc no abre,modelo abv,ajax jersey,csharp operator,asp.net core razor pages,editorial cartooning symbols,server duties,asp.net core environment variables,csharp random,century 21,controller midi,services consultores,services consulting,mvcsd,mvcsc,services.msc,ado.net pdf,asp.net core configuration,ajax marvel,sql update,asp.net tutorial,mvc medical,ado.net entity data model visual studio 2019,wcfs international curriculum,mvc2,ado.net entity data model visual studio 2017,controller switch,update sql,chase online,wcf api,costco,update ubuntu,server jobs near me,webex,sql meaning,sql tutorial,sql commands,controller area network,data universe,ado.net entity framework,ajax tavern,controller symfony,tutorialsteacher,ajax javascript,database,editorial news,services desk,data visualization,model 3,ajax greek,csharp tutorial,mvc pattern,ado.net sql server,ado.net connection,asp.net identity,mvcu,databricks,modelo beer,asp.net core middleware,data analyst,modelo especial,wcf web service,mvc webadvisor,web store,mvcc,editorial article,editorial writing filipino,webmail,mvci,mvctc,
Không có nhận xét nào:
Đăng nhận xét