Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,405 members, 7,808,446 topics. Date: Thursday, 25 April 2024 at 12:02 PM

Creating A Simple CRUD Website With The Simple ASP.NET Webpages Model - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Creating A Simple CRUD Website With The Simple ASP.NET Webpages Model (1775 Views)

Simple CRUD Application In PHP And Mysql – Part 3 / Simple CRUD Application In PHP And Mysql – Part 2 / Simple CRUD Application In PHP And Mysql (2) (3) (4)

(1) (Reply) (Go Down)

Creating A Simple CRUD Website With The Simple ASP.NET Webpages Model by abubaka101: 7:27pm On Apr 05, 2015
ASP.NET is not a new framework. Neither are the programming languages it use: C# & VB.NET.
However it is important to note that ASP.NET is divided into 3 different models.
First is the Webforms model, it ends with .aspx.
Second, is the MVC model. It stands for Model View Controller. It is a model that is suitable for building Web apps, as it separates the both the logic and the display, making it easier to maintain them.
And the third is the Webpages model. This is the most recent addition to the ASP.NET framework. And it uses a simple and easy tools to create dynamic webpages. To add dynamic server content, it uses the new Razor syntax which works with either C# or VB.
[br/]
The Webpages model is easy to learn and it's fun. But its not yet popular.[br/]
I intend to show you how awesome this ASP.NET model is by using it to create a simple CRUD website.
Now CRUD stands for Create, Read, Update and Delete.
I'll stop here for now but will continue soon.

1 Like 1 Share

Re: Creating A Simple CRUD Website With The Simple ASP.NET Webpages Model by abubaka101: 9:28am On Apr 06, 2015
My purpose for creating this thread is show both professional and novice programmers the beauty of this new ASP.NET model.
Having said that, let's continue...
Now the CRUD website will be a simple one. And to make things easier, I'll break up this tutorial into four sections.
ASP.NET Tools Needed: Microsoft has 3 major ASP.NET IDEs: Webmatrix, Visual Web Developer, and Visual Studios. For ASP.NET Webpages model, Webmatrix is the preferred IDE. It's been streamlined and tailor-made for building Webpages. Webmatrix also contains a web server (IIS Express), and a database server (SQL Server Compact). Plus, anytime you like you can install other apps and frameworks on it, such as PHP, Wordress, MySQL, and Joomla.
So, it's settled our devt tool is Webmatrix. You can install through Microsoft's Web Installer on the www.asp.net website.
Re: Creating A Simple CRUD Website With The Simple ASP.NET Webpages Model by abubaka101: 9:55am On Apr 06, 2015
Section 1: Create
What We Will Do Here: Design the webpage using HTML, and get the HTML form inputs ready.


At this juncture I assume you have Webmatrix installed and ready to use. So open it and let's begin.
Start Webmatrix, and click "Site From Template". Select "Empty Site", name the new site "CRUD", and click "OK". Webmatrix creates a new site, and displays a workspace window with a menu at the top (to publish, run, start or stop your website).

In the left panel, there is a list of your web folders and workspace selector to select working with the site, files, database or reports.
Select the "files" workspace.
Create Your First CRUD Webpage: In the ribbon bar, click "New". Choose file type CSHTML, and in the "Name" box, type "default.cshtml".
About CSHTML: The Webpages model uses the Razor markup syntax for adding server-based code. It is much like ASP and PHP. It supports C# and VB. For this tutorial, I will use Razor C#. This technicality is not the concern of this tutorial, however.
Re: Creating A Simple CRUD Website With The Simple ASP.NET Webpages Model by abubaka101: 10:13am On Apr 06, 2015
Open the "default.cshtml" file. Clear the content of the file, and put this instead:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
div.container
{
width:100%;
margin:0px;
border:1px solid gray;
line-height:150%;
}
div.header, div.footer
{
padding:0.5em;
color:white;
background-color:gray;
clear:left;
}
h1.header
{
padding:0;
margin:0;
}
div.left
{
float:left;
width:160px;
margin:0;
padding:1em;
}
div.content
{
margin-left:190px;
border-left:1px solid gray;
padding:1em;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1 class="header">My CRUD Website</h1></div>
<div class="left"><p>I can create magic by myself</p></div>
<!--The div element below will be where we will render the user inputs-->
<div class="content">
<h2>Self Taught CRUD</h2>
<p>Render input here</p>
<p>Abubakar's Tutorial</p></div>
<div class="footer">Copy</div>
</div>
</body>
</html>
Save it.
Right click the default.cshtml, the click "open in browser" to view the page.
Re: Creating A Simple CRUD Website With The Simple ASP.NET Webpages Model by elfico(m): 6:59am On Apr 07, 2015
Following....

(1) (Reply)

What Would Your Computer Say To You If It Could Talk / Precise Financial Systems Ltd Now On Nairaland / Android App -video Converter For Android

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 19
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.