Developing Windows and Web Applications using Visual Studio.NETEric PhanSolution Architect
Homework?Address Control
Credit Card Validationhttp://sharepoint.ssw.com.au/Training/UTSNET/Part 2: .NET WebformsOverview of .NET WebformsData in Webforms TODAYUsabilityRich Web Forms and Other ASP.NET Features Web Security Advanced Topics & Future Technology (Silverlight)Webforms
Recap
12
Work with data in ASP.NET
Session 7: Data in the WebGoal: Bringing data to the weband back :-)
Old Style
New Style
DataBinding
DataGrid
Input ValidationData in our database
Data
Bring database to the webShow/viewDataEnter
OLD way
What is ADO.NET? Set of classes that expose data access services to the .NET programmerADO.NET provides a rich set of components for creating distributed, data-sharing applicationsIt is an integral part of the .NET Framework, providing access to relational data, XML, and application data
WebForm AppsWinForm AppsADO.NETDataSetsSQLConnectionSQLCommandSQLDataAdapterSQLDataReaderSQL Data ProvidersSQL DataXML DataOracle Data…
ObjectsInstead of DataSets we use classesExtensibleCan embed logic and validationA more OO approach
WebForm AppsWinForm AppsObjects/EntitiesData SourcesSQL DataXML DataOracle Data…
DataSets or Business ObjectsWhy use DataSetsA highly functional container for data that can be strongly typedAutomatic change tracking for contained dataSeamless data-binding supportWhy Use ObjectsBusiness Objects (NHibernate, NTiers, LINQ to SQL, LINQ to Entities)Light weightGood data-binding supportExtensible and OOVery easy to useNo SQL command Strings
The new way!LINQ 2 EntitiesLINQ 2 SQL
LINQ to SQL/EntitiesBrand new in the .NET 3.5 FrameworkEasily access and query your database through classesLogical access to class hierarchiesSupports InheritanceIntuitive to use
DBML FileDatabase Mapping LanguageContains a mapping of classes to database tablesHas built in logic to handle selection, updates and deletesCan be customizedwww.hookedonlinq.com
var customers = 	from c in db.Customers			where c.FirstName.StartsWith(“A”)		select cSQL Syntax
var  customers = db.Customers.Where(c => c.FirstName.StartsWith(“A”);Lambda Syntax
Challenge, use this instead of SQL Server Management Studio for a monthLINQPad
Work with data in ASP.NET
See our Ruleshttp://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterLINQ.aspx
Databinding
Bind the dataDataData source
Data BindingDataData sourceFrom MSDN: Data binding is the process that establishes connection between the application UI and business logicBinding controls to data from databaseBind a grid on Webform to a database tableSimple, convenient, and powerful way to create a read/write link between the controls on a form and the data in their application
Databinding the GridView (code)C#NorthwindDataContext db = newNorthwindDataContext();GridView1.DataSource = db.Customers;GridView1.DataBind();English Instantiate our data access classMake the datasource of GridView1 all the customers from our databaseBind the Grid
Databinding the GridView (designer)
Databinding the GridView (designer)
Databinding the GridView (designer)
Databinding the GridView (designer)
Databinding the GridView (designer)
Databinding the GridView (running)
GridViewSelect sort  and edit
Display a Table from a Database
Easy to configure
Without writing any code at allGridViewLots of built in features like:SortingPagingInsertingUpdating DeletingSelecting
Enabling these featuresEnable Delete, Insert, Update on the DataSource
Enabling these featuresEnable them on the GridView
Easy!
Other Data Bindable Web ControlsBindable to Lists DataListDetailsViewFormViewRepeater/ListViewDropDownListListBoxCheckBoxListRadioButtonListBindable to Properties/ColumnsMost other controls
Data-Bound ControlsMost controls in .NET Framework support data bindingControls inherit from the WebControl base classwhich implements IDataBindingsAccessorinterfaceImportant Data-binding properties DataSourceDataMemberDisplayMemberValueMemberDesign your own controls or purchase 3rd party controls
Passing Parameters
Passing Parameters between pagesPass parameters to pages or controlsPass parameters to our data sourcesParameters can be obtained from:Query StringSession VariableControl PropertyHidden FieldCookie
1. Create a CustomerDetails.aspx Add a Details View and create a new Datasource
2. Create a LINQ Data Source
3. Specify the Where clause
4. Make it read from the Query String
5. Change the Select on the GridView to Link to the CustomerDetails Page
6. Edit the templates
7. Delete Select and Add a Hyperlink
8. Configure the HyperlinkCustomerDetails.aspx?CustomerID={0}
Run it
Validation – Don’t trust anyone
Validation - Bring database to the webShow/viewDataEnter
ValidationWhy do we need it?PEBCACBad Data
Input Validation
Why use Validations?Seamless verification of data fieldsCheck for mandatory fieldsCheck for correct data formatsCheck for data rangesReduces incorrect data entered into your databasePrevent possible runtime exceptions
Validation TypesClientShow/viewDataEnterClientServer
Validation TypesClient-Side ValidationValidations are performed before the form is posted backQuick and responsive for the end userInsecureServer-Side ValidationValidation checks are performed on the serverSecure because these checks cannot be easily by passedSometimes can be slowRecommendationUse both the typesThis approach provides the best of both worldsClientShow/viewDataEnterClientServer
ASP.NET Validation Server ControlsRequiredFieldValidatorCompareValidatorRangeValidatorRegularExpressionValidatorCustomValidatorValidationSummary
To put the Northwind database up on the web?CRUD for all tablesPages for all tablesValidation	So how long do you think it would take...
1 line of code5 Minutes

More Related Content

PDF
Exploring SQL Server Azure Database Relationships Using Lightning Connect
PPTX
Word on the Server
PPTX
Developing Sandbox Solutions
PPTX
Kathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All Together
PPTX
Library Presentation
PPTX
Web forms I'm still alive
PPTX
Developing With Data Technologies
PPTX
Eugene Rosenfeld: SharePoint Custom Field Types
Exploring SQL Server Azure Database Relationships Using Lightning Connect
Word on the Server
Developing Sandbox Solutions
Kathryn Birstein: SharePoint 2010 Business Intelligence-Brining It All Together
Library Presentation
Web forms I'm still alive
Developing With Data Technologies
Eugene Rosenfeld: SharePoint Custom Field Types

What's hot (20)

PPTX
Design mission-critical enterprise applications with Power Automate and Docto...
PPTX
Mostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best Practices
PPTX
Spring tutorials
PPTX
Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013
PPTX
Integrating SharePoint 2010 and Visual Studio Lightswitch
PPTX
SPS Belgium 2015 - High-trust Apps for On-Premises Development
PPTX
Greg Hurlman: Developing Custom Service Applications
PPTX
The Who, What, Why and How of Active Directory Federation Services (AD FS)
PDF
Microsoft AZ-204 Exam Dumps
PPTX
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
PPT
Mule microsoft
PPTX
Integrate mule esb with microsoft office 365 share point
PPTX
Microsoft Graph developer community call-March 2020
PPT
Whats New In Asp.Net Web Forms 4
PPTX
Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...
PPTX
An introduction to Microsoft Graph for developers
PDF
mini_Project_SRS
PDF
Work experiences at Softcodeit
PPTX
Using microsoft flow in real world projects 2 years later and what's next
PPTX
SharePoint 2013 and ADFS
Design mission-critical enterprise applications with Power Automate and Docto...
Mostafa Elzoghbi: SharePoint 2010 Sandbox Solutions Best Practices
Spring tutorials
Sydney SPUG - February 2014 - Pitfalls of Migrating to SharePoint 2013
Integrating SharePoint 2010 and Visual Studio Lightswitch
SPS Belgium 2015 - High-trust Apps for On-Premises Development
Greg Hurlman: Developing Custom Service Applications
The Who, What, Why and How of Active Directory Federation Services (AD FS)
Microsoft AZ-204 Exam Dumps
Granite state #spug The #microsoftGraph and #SPFx on steroids with #AzureFunc...
Mule microsoft
Integrate mule esb with microsoft office 365 share point
Microsoft Graph developer community call-March 2020
Whats New In Asp.Net Web Forms 4
Rencore Power Automate Mini Summit : Power Automate Business Process Manageme...
An introduction to Microsoft Graph for developers
mini_Project_SRS
Work experiences at Softcodeit
Using microsoft flow in real world projects 2 years later and what's next
SharePoint 2013 and ADFS
Ad

Viewers also liked (7)

PPS
Asp.net new
PPT
ASP.NET 01 - Introduction
PPTX
Better User Experience with .NET
PPT
N-Tier Application with Windows Forms - Deployment and Security
PPT
Web Service
PPT
Structured Process Of Developing A Web Application
PPTX
SQL Server - Introduction to TSQL
Asp.net new
ASP.NET 01 - Introduction
Better User Experience with .NET
N-Tier Application with Windows Forms - Deployment and Security
Web Service
Structured Process Of Developing A Web Application
SQL Server - Introduction to TSQL
Ad

Similar to Work with data in ASP.NET (20)

KEY
WPF: Working with Data
PPTX
Ch 7 data binding
PPTX
PDF
The entity framework 4.0 and asp.net web forms getting started
DOCX
Grid view control
PDF
The entity framework 4 and asp net web forms
PPTX
PATTERNS07 - Data Representation in C#
PDF
Mcts Selfpaced Training Kit Exam 70516 Accessing Data With Microsoft Net Fram...
PPTX
Datasource in asp.net
PPTX
ASP.NET Lecture 4
KEY
Introducing LINQ
PPT
the .NET Framework. It provides the claf
PPT
Real-world Entity Framework
PPSX
06 asp.net session08
PPT
Visual Studio 2008 & .Net 3.5
PPS
06 asp.net session08
PDF
Ado Fundamentals
PDF
Database Programming With Visual Basic Net And Adonet Tips Tutorials And Code...
PDF
Net course content
PPS
Vb.net session 06
WPF: Working with Data
Ch 7 data binding
The entity framework 4.0 and asp.net web forms getting started
Grid view control
The entity framework 4 and asp net web forms
PATTERNS07 - Data Representation in C#
Mcts Selfpaced Training Kit Exam 70516 Accessing Data With Microsoft Net Fram...
Datasource in asp.net
ASP.NET Lecture 4
Introducing LINQ
the .NET Framework. It provides the claf
Real-world Entity Framework
06 asp.net session08
Visual Studio 2008 & .Net 3.5
06 asp.net session08
Ado Fundamentals
Database Programming With Visual Basic Net And Adonet Tips Tutorials And Code...
Net course content
Vb.net session 06

More from Peter Gfader (20)

PDF
Achieving Technical Excellence in Your Software Teams - from Devternity
PDF
You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019
PDF
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
PPTX
How to make more impact as an engineer
PDF
13 explosive things you should try as an agilist
PPTX
You cant be agile if your code sucks
PDF
Use Scrum and Continuous Delivery to innovate like crazy!
PDF
Innovation durch Scrum und Continuous Delivery
PPTX
Speed = $$$
PPTX
Qcon london2012 recap
PPTX
Continuous Delivery with TFS msbuild msdeploy
PPTX
Silverlight vs HTML5 - Lessons learned from the real world...
PPTX
Clean Code Development
PPTX
Data Mining with SQL Server 2008
PPTX
SSAS - Other Cube Browsers
PPTX
Reports with SQL Server Reporting Services
PDF
OLAP – Creating Cubes with SQL Server Analysis Services
PPT
Business Intelligence with SQL Server
PPTX
SQL Server - Full text search
PPTX
Usability AJAX and other ASP.NET Features
Achieving Technical Excellence in Your Software Teams - from Devternity
You Can't Be Agile If Your Testing Practices Suck - Vilnius October 2019
You Cant Be Agile If Your Code Sucks (with 9 Tips For Dev Teams)
How to make more impact as an engineer
13 explosive things you should try as an agilist
You cant be agile if your code sucks
Use Scrum and Continuous Delivery to innovate like crazy!
Innovation durch Scrum und Continuous Delivery
Speed = $$$
Qcon london2012 recap
Continuous Delivery with TFS msbuild msdeploy
Silverlight vs HTML5 - Lessons learned from the real world...
Clean Code Development
Data Mining with SQL Server 2008
SSAS - Other Cube Browsers
Reports with SQL Server Reporting Services
OLAP – Creating Cubes with SQL Server Analysis Services
Business Intelligence with SQL Server
SQL Server - Full text search
Usability AJAX and other ASP.NET Features

Recently uploaded (20)

PDF
HSE 2022-2023.pdf الصحه والسلامه هندسه نفط
PPTX
MMW-CHAPTER-1-final.pptx major Elementary Education
PDF
African Communication Research: A review
PPSX
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
PDF
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
PDF
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
PPTX
Power Point PR B.Inggris 12 Ed. 2019.pptx
PPTX
Copy of ARAL Program Primer_071725(1).pptx
PPTX
Key-Features-of-the-SHS-Program-v4-Slides (3) PPT2.pptx
PPTX
CHROMIUM & Glucose Tolerance Factor.pptx
PDF
Kalaari-SaaS-Founder-Playbook-2024-Edition-.pdf
PDF
GSA-Past-Papers-2010-2024-2.pdf CSS examination
PDF
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
PPTX
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
PPTX
climate change of delhi impacts on climate and there effects
PPTX
Cite It Right: A Compact Illustration of APA 7th Edition.pptx
PDF
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
PDF
faiz-khans about Radiotherapy Physics-02.pdf
PPTX
GW4 BioMed Candidate Support Webinar 2025
PPTX
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
HSE 2022-2023.pdf الصحه والسلامه هندسه نفط
MMW-CHAPTER-1-final.pptx major Elementary Education
African Communication Research: A review
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
Power Point PR B.Inggris 12 Ed. 2019.pptx
Copy of ARAL Program Primer_071725(1).pptx
Key-Features-of-the-SHS-Program-v4-Slides (3) PPT2.pptx
CHROMIUM & Glucose Tolerance Factor.pptx
Kalaari-SaaS-Founder-Playbook-2024-Edition-.pdf
GSA-Past-Papers-2010-2024-2.pdf CSS examination
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
climate change of delhi impacts on climate and there effects
Cite It Right: A Compact Illustration of APA 7th Edition.pptx
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
faiz-khans about Radiotherapy Physics-02.pdf
GW4 BioMed Candidate Support Webinar 2025
Unit1_Kumod_deeplearning.pptx DEEP LEARNING

Work with data in ASP.NET

Editor's Notes

  • #2: Click to add notesPeter Gfader Developing Windows and Web applications
  • #6: Request ResponseOpen browser and browse around
  • #9: Goal: Show View data to users on the webLet users enter and modify data
  • #19: Show how easy it isHow many code lines did i write?Show them the old wayHuge difference!
  • #27: Changes to Datasource get forwarded to databaseChanges from database get forwarded to data grid
  • #28: Property DataSource and DataMember on grid
  • #41: Show controls in VSDataList = More for List layout (http://msdn.microsoft.com/en-us/magazine/cc301328.aspx )DetailsView = mainly for editing (row/col switched) 1 record at a timeFormView = like detailsview but more control over html rendered code (layout) that’s goodListView = like datalist but more control again, see EA emp Repeater = same as Listview, Listview replaces repeaterDropDownListListBox = simple list of itemsCheckBoxListRadioButtonList
  • #42: Go to website: telerikTelerik RAD ControlsComponent ArtInfragisticsDevexpressJanus
  • #44: Suggest or common ones are querystring, hidden fieldCookies saving bits of info for all pagesE.g. Select a row from the grid and show the details in a DetailsViewPass the selected row’s ID (e.g. ContactID) as a query string parameterE.g. http://localhost:1234/MyWebApp/Details.aspx?ContactID=1
  • #53: Show url with IDPostback http://www.search-cube.com/
  • #56: Problem Exists Between Chair and ComputerClient database SWIFT project
  • #60: ASP.NET existing Validation controls create client side script for us
  • #61: CustomValidator Method Validate write your own code there (SERVER SIDE)