SlideShare a Scribd company logo
1 of 14
WELCOME TO IT PROGRAMMING WORLD
अगर आपने अभी तक मेरे चैनल को सब्सक्राइब नह ीं ककया है
तो प्ल ज कर ल जजये जो मई नेक्स्ट विडियो अपलोि कर तो
आपको पता चल सके
आगत आपको ये विडियो एच लगा है तो विडियो को LIKE और
SHARE जरूर करे
 धन्यिाद्
 आईट प्रोग्राममींग िर्लिड
Tightly Coupled View
(Model bounded view)
in Asp .NET MVC
In asp.net MVC model bounded view is a tightly coupled and it is used to create view. let’s create
model bounded view or tightly coupled view in asp.net MVC application for that first we need to
create model, controller and view.
2
Working with Controllers
Controller:
Process incoming request.
Executes the appropriate code initiated or
required by the user
Communicating with the "Model" to validate
and process the data.
3
4/18/2018
What is Controllers
Controller - is a class...
it is .cs code [C# file], which is inherited by a
built-in controller classes.
4
Create Model in Asp.Net MVC Application
 For adding Model Right click on Models folder à select Add à then select Class in asp.net mvc
application. After that a new Dialog (Add New Item) will popup asking you to enter Class name in that
enter name “Person” like as shown below
5
After adding model now let’s add some properties in this
Person class like as shown following
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;

 namespace Tutorial3.Models
 {
 public class Person
 {
 public int ID { get; set; }
 public string Name { get; set; }
 public string Address { get; set; }
 public string Mobileno { get; set; }
 }
 }
6
Create Controller in Asp.Net MVC Application
7
After adding controller you can see default code
generated
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Tutorial3.Controllers
{
public class PersonDetailsController : Controller
{
//
// GET: /PersonDetails/
public ActionResult Index()
{
return View();
}
}
}
Now we will change controller method by adding [HttpGet] attribute to Action Method and return new
instance Model Person like as shown below
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.Mvc;
 using Tutorial3.Models;
 namespace Tutorial3.Controllers
 {
 public class PersonDetailsController : Controller
 {
 //
 // GET: /PersonDetails/
 [HttpGet]
 public ActionResult Index()
 {
 return View(new Person());
 }
 }
 }
8
Create View in Asp.Net MVC Application
 Now let’s add view for that just right click
inside controller and select Add View you
will get a pop up like as shown below.
Inside this popup you will see default
View name will be there no need to
change that and we are going to use
Razor engine that why we should select
Razor engine. In Model class we are
going to select Person Model which we
created. In Scaffold template
select Create item and click on Add
button finally.
9
 After click Add button our View will create which is tightly coupled to model that would be like as shown below

 @model Tutorial3.Models.Person

 @{
 ViewBag.Title = "Index";
 }
 <h2>Index</h2>
 @using (Html.BeginForm()) {
 @Html.ValidationSummary(true)
 <fieldset>
 <legend>Person</legend>
 <div class="editor-label">
 @Html.LabelFor(model => model.Name)
 </div>
 <div class="editor-field">
 @Html.EditorFor(model => model.Name)
 @Html.ValidationMessageFor(model => model.Name)
 </div>
10
 <div class="editor-label">
 @Html.LabelFor(model => model.Address)
 </div>
 <div class="editor-field">
 @Html.EditorFor(model => model.Address)
 @Html.ValidationMessageFor(model => model.Address)
 </div>
 <div class="editor-label">
 @Html.LabelFor(model => model.Mobileno)
 </div>
 <div class="editor-field">
 @Html.EditorFor(model => model.Mobileno)
 @Html.ValidationMessageFor(model => model.Mobileno)
 </div>
11
Continue Codes
 <p>
 <input type="submit" value="Create"/>
 </p>
 </fieldset>
 }
 <div>
 @Html.ActionLink("Back to List", "Index")
 </div>
 @section Scripts {
 @Scripts.Render("~/bundles/jqueryval")

 }
12
Here red mark border is showing view is tightly
coupled to person Model. 13
This way we can achieve Model bounded view or tightly coupled
view in asp.net MVC.
This way we can achieve Model bounded view or tightly
coupled view in asp.net MVC.
Thanking for watching ……………..
Please Subscribe my Channel for next Coming videos direct to
You……….
 Hope This Video is helpful for you… Like and share not
forget……..
 If any feedback Comments ………
 IT PROGRAMMING WORLD
 KRISHNA RAJPUT SINGH

More Related Content

What's hot

Getting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and RazorGetting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and RazorDan Wahlin
 
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry GervinWill your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry GervinBarry Gervin
 
Introduction to Android Programming
Introduction to Android ProgrammingIntroduction to Android Programming
Introduction to Android ProgrammingRaveendra R
 
ASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp PresentationASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp Presentationbuildmaster
 
Hands on SPA development
Hands on SPA developmentHands on SPA development
Hands on SPA developmentShawn Constance
 
Introduction To ASP.Net MVC
Introduction To ASP.Net MVCIntroduction To ASP.Net MVC
Introduction To ASP.Net MVCJoe Wilson
 
Simple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanSimple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanGigin Krishnan
 
Test Drive Development in Ruby On Rails
Test Drive Development in Ruby On RailsTest Drive Development in Ruby On Rails
Test Drive Development in Ruby On RailsNyros Technologies
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right nowCaleb Jenkins
 
Learn html and css from scratch
Learn html and css from scratchLearn html and css from scratch
Learn html and css from scratchMohd Manzoor Ahmed
 
Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS FrameworkRaveendra R
 
VIPER Architecture
VIPER ArchitectureVIPER Architecture
VIPER ArchitectureAhmed Lotfy
 

What's hot (19)

Getting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and RazorGetting Started with ASP.NET MVC 3 and Razor
Getting Started with ASP.NET MVC 3 and Razor
 
Test automation
Test  automationTest  automation
Test automation
 
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
From mvc to viper
From mvc to viperFrom mvc to viper
From mvc to viper
 
AngularJS Scopes
AngularJS ScopesAngularJS Scopes
AngularJS Scopes
 
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry GervinWill your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
 
Blindsql
BlindsqlBlindsql
Blindsql
 
Jsp session 2
Jsp   session 2Jsp   session 2
Jsp session 2
 
Introduction to Android Programming
Introduction to Android ProgrammingIntroduction to Android Programming
Introduction to Android Programming
 
ASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp PresentationASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp Presentation
 
Hands on SPA development
Hands on SPA developmentHands on SPA development
Hands on SPA development
 
Introduction To ASP.Net MVC
Introduction To ASP.Net MVCIntroduction To ASP.Net MVC
Introduction To ASP.Net MVC
 
Simple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanSimple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnan
 
Test Drive Development in Ruby On Rails
Test Drive Development in Ruby On RailsTest Drive Development in Ruby On Rails
Test Drive Development in Ruby On Rails
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right now
 
Learn html and css from scratch
Learn html and css from scratchLearn html and css from scratch
Learn html and css from scratch
 
Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS Framework
 
VIPER Architecture
VIPER ArchitectureVIPER Architecture
VIPER Architecture
 

Similar to Tightly coupled view (model bounded view)

LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLAkhil Mittal
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101Rich Helton
 
Tutorial mvc (pelajari ini jika ingin tahu mvc) keren
Tutorial mvc (pelajari ini jika ingin tahu mvc) kerenTutorial mvc (pelajari ini jika ingin tahu mvc) keren
Tutorial mvc (pelajari ini jika ingin tahu mvc) kerenSony Suci
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentationBhavin Shah
 
Adding a view
Adding a viewAdding a view
Adding a viewNhan Do
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010vchircu
 
Mvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senjaMvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senjaalifha12
 
Asp 2-createaspnetmvc
Asp 2-createaspnetmvcAsp 2-createaspnetmvc
Asp 2-createaspnetmvcFajar Baskoro
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkAkhil Mittal
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S GuideAlicia Buske
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkAkhil Mittal
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
 
ASP.net Manual final.pdf
ASP.net Manual final.pdfASP.net Manual final.pdf
ASP.net Manual final.pdfSwapnilGujar13
 
asp.net - for merge.docx
asp.net - for merge.docxasp.net - for merge.docx
asp.net - for merge.docxSwapnilGujar13
 
Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desaijinaldesailive
 
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)M Ahsan Khan
 

Similar to Tightly coupled view (model bounded view) (20)

LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
 
ASP.NET MVC3 RAD
ASP.NET MVC3 RADASP.NET MVC3 RAD
ASP.NET MVC3 RAD
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Tutorial mvc (pelajari ini jika ingin tahu mvc) keren
Tutorial mvc (pelajari ini jika ingin tahu mvc) kerenTutorial mvc (pelajari ini jika ingin tahu mvc) keren
Tutorial mvc (pelajari ini jika ingin tahu mvc) keren
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Adding a view
Adding a viewAdding a view
Adding a view
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
 
MVC Training Part 2
MVC Training Part 2MVC Training Part 2
MVC Training Part 2
 
Mvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senjaMvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senja
 
Asp 2-createaspnetmvc
Asp 2-createaspnetmvcAsp 2-createaspnetmvc
Asp 2-createaspnetmvc
 
Mvc acchitecture
Mvc acchitectureMvc acchitecture
Mvc acchitecture
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFramework
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
ASP.net Manual final.pdf
ASP.net Manual final.pdfASP.net Manual final.pdf
ASP.net Manual final.pdf
 
asp.net - for merge.docx
asp.net - for merge.docxasp.net - for merge.docx
asp.net - for merge.docx
 
Mvc interview questions – deep dive jinal desai
Mvc interview questions – deep dive   jinal desaiMvc interview questions – deep dive   jinal desai
Mvc interview questions – deep dive jinal desai
 
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)
 
ASP.NET Identity
ASP.NET IdentityASP.NET Identity
ASP.NET Identity
 

Recently uploaded

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 

Recently uploaded (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 

Tightly coupled view (model bounded view)

  • 1. WELCOME TO IT PROGRAMMING WORLD अगर आपने अभी तक मेरे चैनल को सब्सक्राइब नह ीं ककया है तो प्ल ज कर ल जजये जो मई नेक्स्ट विडियो अपलोि कर तो आपको पता चल सके आगत आपको ये विडियो एच लगा है तो विडियो को LIKE और SHARE जरूर करे  धन्यिाद्  आईट प्रोग्राममींग िर्लिड
  • 2. Tightly Coupled View (Model bounded view) in Asp .NET MVC In asp.net MVC model bounded view is a tightly coupled and it is used to create view. let’s create model bounded view or tightly coupled view in asp.net MVC application for that first we need to create model, controller and view. 2
  • 3. Working with Controllers Controller: Process incoming request. Executes the appropriate code initiated or required by the user Communicating with the "Model" to validate and process the data. 3 4/18/2018
  • 4. What is Controllers Controller - is a class... it is .cs code [C# file], which is inherited by a built-in controller classes. 4
  • 5. Create Model in Asp.Net MVC Application  For adding Model Right click on Models folder à select Add à then select Class in asp.net mvc application. After that a new Dialog (Add New Item) will popup asking you to enter Class name in that enter name “Person” like as shown below 5
  • 6. After adding model now let’s add some properties in this Person class like as shown following  using System;  using System.Collections.Generic;  using System.Linq;  using System.Web;   namespace Tutorial3.Models  {  public class Person  {  public int ID { get; set; }  public string Name { get; set; }  public string Address { get; set; }  public string Mobileno { get; set; }  }  } 6
  • 7. Create Controller in Asp.Net MVC Application 7 After adding controller you can see default code generated using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Tutorial3.Controllers { public class PersonDetailsController : Controller { // // GET: /PersonDetails/ public ActionResult Index() { return View(); } } }
  • 8. Now we will change controller method by adding [HttpGet] attribute to Action Method and return new instance Model Person like as shown below  using System;  using System.Collections.Generic;  using System.Linq;  using System.Web;  using System.Web.Mvc;  using Tutorial3.Models;  namespace Tutorial3.Controllers  {  public class PersonDetailsController : Controller  {  //  // GET: /PersonDetails/  [HttpGet]  public ActionResult Index()  {  return View(new Person());  }  }  } 8
  • 9. Create View in Asp.Net MVC Application  Now let’s add view for that just right click inside controller and select Add View you will get a pop up like as shown below. Inside this popup you will see default View name will be there no need to change that and we are going to use Razor engine that why we should select Razor engine. In Model class we are going to select Person Model which we created. In Scaffold template select Create item and click on Add button finally. 9
  • 10.  After click Add button our View will create which is tightly coupled to model that would be like as shown below   @model Tutorial3.Models.Person   @{  ViewBag.Title = "Index";  }  <h2>Index</h2>  @using (Html.BeginForm()) {  @Html.ValidationSummary(true)  <fieldset>  <legend>Person</legend>  <div class="editor-label">  @Html.LabelFor(model => model.Name)  </div>  <div class="editor-field">  @Html.EditorFor(model => model.Name)  @Html.ValidationMessageFor(model => model.Name)  </div> 10
  • 11.  <div class="editor-label">  @Html.LabelFor(model => model.Address)  </div>  <div class="editor-field">  @Html.EditorFor(model => model.Address)  @Html.ValidationMessageFor(model => model.Address)  </div>  <div class="editor-label">  @Html.LabelFor(model => model.Mobileno)  </div>  <div class="editor-field">  @Html.EditorFor(model => model.Mobileno)  @Html.ValidationMessageFor(model => model.Mobileno)  </div> 11
  • 12. Continue Codes  <p>  <input type="submit" value="Create"/>  </p>  </fieldset>  }  <div>  @Html.ActionLink("Back to List", "Index")  </div>  @section Scripts {  @Scripts.Render("~/bundles/jqueryval")   } 12
  • 13. Here red mark border is showing view is tightly coupled to person Model. 13 This way we can achieve Model bounded view or tightly coupled view in asp.net MVC. This way we can achieve Model bounded view or tightly coupled view in asp.net MVC.
  • 14. Thanking for watching …………….. Please Subscribe my Channel for next Coming videos direct to You……….  Hope This Video is helpful for you… Like and share not forget……..  If any feedback Comments ………  IT PROGRAMMING WORLD  KRISHNA RAJPUT SINGH