SlideShare a Scribd company logo
Chapter 8 Data Binding and Representation It is a capital mistake to theorize before one has data. Sir Arthur Conan Doyle,  The Adventures of Sherlock Holmes , “Scandal in Bohemia”
Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Data Binding ,[object Object],[object Object],[object Object]
Data Binding ,[object Object],[object Object]
Data Binding ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What Can Be a Data Source? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Data Binding an Array <asp:DropDownList id=&quot;drpSample&quot; runat=&quot;server&quot; /> private void Page_Load(object sender, System.EventArgs e) { string[] names = new string[3] { &quot;Austen&quot;,&quot;Dante&quot;,&quot;Goethe&quot; }; drpSample.DataSource = names; drpSample.DataBind(); }
Using Collections ,[object Object],[object Object],[object Object]
Collection Classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Collection Interfaces
Using the Collections ,[object Object],[object Object],[object Object],[object Object],[object Object]
Using an ArrayList ArrayList myList = new ArrayList(); … Customer c1 = new Customer( … ); myList.Add( c1 ); int index = … Customer c = (Customer)myList[index]; // Create sample customer objects Customer c1 = new Customer(&quot;334&quot;, &quot;Thomas&quot;, &quot;Hobbes&quot;, &quot;123-4567&quot;); Customer c2 = new Customer(&quot;123&quot;, &quot;Jean-Jacques&quot;, &quot;Rosseau&quot;, &quot;456-1267&quot;); Customer c3 = new Customer(&quot;085&quot;, &quot;David&quot;, &quot;Hume&quot;, &quot;564-7823&quot;); // Create and populate collection ArrayList myList = new ArrayList(); myList.Add(c1); myList.Add(c2); myList.Add(c3); // Data bind collection to control lboxCustomers.DataSource = myList; lboxCustomers.DataBind();
Using an ArrayList <asp:ListBox id=&quot;lboxCustomers&quot; runat=&quot;server&quot;  DataTextField=&quot;Name&quot; DataValueField=&quot;Id&quot;  />
Problems with Standard Collection Classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Generics ,[object Object],[object Object],[object Object],[object Object],[object Object]
Using Generics List<int> numbers = new List<int>(); List<Customer> customers = new List<Customer>(); numbers.Add(47); customers.Add( new Customer(&quot;085&quot;,&quot;David&quot;,&quot;Hume&quot;,&quot;564-7823&quot;) ); int n = numbers[0]; Customer c = customers[0];
Dictionary Collections ,[object Object],[object Object],[object Object],[object Object]
Using a Dictionary Dictionary<string, Customer> dict = new Dictionary<string, Customer>(); String id = &quot;085&quot;; Customer c = new Customer(id, &quot;David&quot;, &quot;Hume&quot;, &quot;564-7823&quot;); dict.Add(id, c); … Customer c = dict[key];
Using a Dictionary List<Customer> myList = new List<Customer>(); … foreach (Customer c in myList) { if (c.Id == valueToFind) { // Do something with this customer } } Dictionary<string, Customer> dict = new  Dictionary<string, Customer>(); Customer c = dict[valueToFind]; if (c != null) { // Do something with this customer }
Iterating a Dictionary Dictionary<string, Customer> dict =  new Dictionary<string, Customer>(); // This does NOT work foreach (Customer c in dict) Dictionary<string, Customer> dict =  new Dictionary<string, Customer>(); // This does work foreach (Customer c in  dict.Values ) { labMsg.Text += c.Id + &quot;,&quot; + c.LastName + &quot;<br/>&quot;; }
DataSet ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DataSet
Populating a DataSet ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DataTable ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Defining a DataTable DataTable table = new DataTable(); DataColumn firstNameCol = new DataColumn(&quot;FirstName&quot;, typeof(string)); table.Columns.Add(firstNameCol); DataColumn idCol = new DataColumn(); idCol.ColumnName = &quot;Id&quot;; idCol.DataType = typeof(Int32); idCol.AllowDBNull = false; idCol.Unique = true; table.Columns.Add(idCol);
Filling the DataTable DataRow r1 = table.NewRow(); r1[0] = 1; r1[1] = &quot;Thomas&quot;; r1[2] = &quot;Hobbes&quot;; r1[3] = &quot;123-4567&quot;; table.Rows.Add(r1); DataRow r2 = table.NewRow(); r2[&quot;Id&quot;] = 2; r2[&quot;FirstName&quot;] = &quot;David&quot;; r2[&quot;LastName&quot;] = &quot;Hume&quot;; r2[&quot;Phone&quot;] = &quot;564-7823&quot;; table.Rows.Add(r2);
Using a DataSet DataSet ds = new DataSet(); DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); … ds.Tables.Add( dt1 ); ds.Tables.Add( dt2 ); DataTable t1 = ds.Tables[0]; DataTable t2 = ds.Tables[1]; ds.Tables[0].TableName = &quot;Cust&quot;; … DataTable dt = ds.Tables[&quot;Cust&quot;]; DataRow dr = ds.Tables[0].Rows[0]; string s1 = (string)dr[1]; string s2 = (string)dr[&quot;Phone&quot;]; string s3 = (string)ds.Tables[0].Rows[0][&quot;Phone&quot;];
Typed DataSets ,[object Object],[object Object],[object Object],[object Object],SampleTypedDataSet myDataSet = new SampleTypedDataSet(); … double price = myDataSet.Products[0].Price;
XML Integration try { DataSet ds = new DataSet(); ds.ReadXml( Server.MapPath(&quot;~/App_Data/somefile.xml&quot;) ); // Use the data set } catch (IOException) { // Handle the error } ds.WriteXml(&quot;output.xml&quot;);
Choosing a Data Container ,[object Object]
Internal Data ,[object Object],[object Object],[object Object]
Storing Internal Data ,[object Object],[object Object],[object Object],[object Object],[object Object]
.NET Collections as Containers ,[object Object],[object Object]
.NET Collections as Containers ,[object Object],[object Object],[object Object]
Custom Collections as Containers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DataSets as Containers ,[object Object],[object Object],[object Object],[object Object],[object Object]
Typed DataSets as Containers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

Div tag presentation
Div tag presentationDiv tag presentation
Div tag presentation
alyssa_lum11
 
State management
State managementState management
State management
teach4uin
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
DrSonali Vyas
 
Htmltag.ppt
Htmltag.pptHtmltag.ppt
Htmltag.ppt
anandha ganesh
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
Raed Aldahdooh
 
Web content mining
Web content miningWeb content mining
Web content mining
Akanksha Dombe
 
Sessions and cookies
Sessions and cookiesSessions and cookies
Sessions and cookies
www.netgains.org
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
vikasgaur31
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
schwebbie
 
Php array
Php arrayPhp array
Php array
Core Lee
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
Iblesoft
 
Asp.net caching
Asp.net cachingAsp.net caching
Asp.net caching
Mindfire Solutions
 
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessions
Lena Petsenchuk
 
Xml
XmlXml
Servlet life cycle
Servlet life cycleServlet life cycle
Servlet life cycle
Venkateswara Rao N
 
CSS
CSSCSS
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
Aarti P
 
Html tags
Html tagsHtml tags
Html tags
sotero66
 
Web controls
Web controlsWeb controls
Web controls
Sarthak Varshney
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
priya Nithya
 

What's hot (20)

Div tag presentation
Div tag presentationDiv tag presentation
Div tag presentation
 
State management
State managementState management
State management
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Htmltag.ppt
Htmltag.pptHtmltag.ppt
Htmltag.ppt
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
 
Web content mining
Web content miningWeb content mining
Web content mining
 
Sessions and cookies
Sessions and cookiesSessions and cookies
Sessions and cookies
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
Php array
Php arrayPhp array
Php array
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
 
Asp.net caching
Asp.net cachingAsp.net caching
Asp.net caching
 
Cookies and sessions
Cookies and sessionsCookies and sessions
Cookies and sessions
 
Xml
XmlXml
Xml
 
Servlet life cycle
Servlet life cycleServlet life cycle
Servlet life cycle
 
CSS
CSSCSS
CSS
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
 
Html tags
Html tagsHtml tags
Html tags
 
Web controls
Web controlsWeb controls
Web controls
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
 

Viewers also liked

Joyful Mysteries 2: Visitation
Joyful Mysteries 2: VisitationJoyful Mysteries 2: Visitation
Joyful Mysteries 2: Visitation
QualityWebDesign
 
Haushalt 2015 Bergisch Gladbach - Entwurf
Haushalt 2015 Bergisch Gladbach - EntwurfHaushalt 2015 Bergisch Gladbach - Entwurf
Haushalt 2015 Bergisch Gladbach - Entwurf
Bürgerportal Bergisch Gladbach
 
Slidershare1
Slidershare1Slidershare1
La retórica en el lenguaje visual
La retórica en el lenguaje visualLa retórica en el lenguaje visual
La retórica en el lenguaje visual
Pamela Alonso Velazquez
 
Miguel peña copia
Miguel peña   copiaMiguel peña   copia
Miguel peña copia
niguel Peña
 
B6 obtenção de matéria (parte ii)
B6   obtenção de matéria (parte ii)B6   obtenção de matéria (parte ii)
B6 obtenção de matéria (parte ii)
Nuno Correia
 
A cabezazos contra el techo de cristal en #EBE15 Begoña Martínez y Beatriz Se...
A cabezazos contra el techo de cristal en #EBE15 Begoña Martínez y Beatriz Se...A cabezazos contra el techo de cristal en #EBE15 Begoña Martínez y Beatriz Se...
A cabezazos contra el techo de cristal en #EBE15 Begoña Martínez y Beatriz Se...
Begoña Martínez
 
1. cap1 farm general
1. cap1 farm general1. cap1 farm general
1. cap1 farm general
Tec.Terapia Fisica
 
Cook ijmbl 2010_preprint
Cook ijmbl 2010_preprintCook ijmbl 2010_preprint
Cook ijmbl 2010_preprint
University of the West of England
 
Marketing News 04
Marketing News 04Marketing News 04
Marketing News 04
ekonomistak
 
Apache license
Apache licenseApache license
Apache license
7410963
 
Presentación Lipo-Body Laser
Presentación Lipo-Body LaserPresentación Lipo-Body Laser
Presentación Lipo-Body Laser
BodyCenter San Pedro Sula
 
Difusores de Gran Caudal de Aire y Conos de Alta Inducción - Serie DCH y CI
Difusores de Gran Caudal de Aire y Conos de Alta Inducción - Serie DCH y CIDifusores de Gran Caudal de Aire y Conos de Alta Inducción - Serie DCH y CI
Difusores de Gran Caudal de Aire y Conos de Alta Inducción - Serie DCH y CI
MET MANN, Fabricante de Climatización y Ventilación
 
Ygj 02-adhesive-tape-roller
Ygj 02-adhesive-tape-rollerYgj 02-adhesive-tape-roller
Ygj 02-adhesive-tape-roller
Labthink International,Inc.
 
La inclusión es un verbo.
La inclusión es un verbo.La inclusión es un verbo.
La inclusión es un verbo.
José María
 
Locsateli. Control y Gestion de flotas. Tracking fleet.
Locsateli. Control y Gestion de flotas. Tracking fleet.Locsateli. Control y Gestion de flotas. Tracking fleet.
Locsateli. Control y Gestion de flotas. Tracking fleet.
locsateli
 
HAY - catalogue 2013 - 2nd edition
HAY - catalogue 2013 - 2nd editionHAY - catalogue 2013 - 2nd edition
HAY - catalogue 2013 - 2nd edition
agence-kali
 
Smlatam Analysis V1
Smlatam Analysis V1Smlatam Analysis V1
Smlatam Analysis V1
Jesus Hoyos
 
AISLAMIENTO ACÚSTICO EN VENTANAS
AISLAMIENTO ACÚSTICO EN VENTANASAISLAMIENTO ACÚSTICO EN VENTANAS
AISLAMIENTO ACÚSTICO EN VENTANAS
Fundación Laboral de la Construcción
 
Api presentation
Api presentationApi presentation
Api presentation
Patrick Marin Lopez
 

Viewers also liked (20)

Joyful Mysteries 2: Visitation
Joyful Mysteries 2: VisitationJoyful Mysteries 2: Visitation
Joyful Mysteries 2: Visitation
 
Haushalt 2015 Bergisch Gladbach - Entwurf
Haushalt 2015 Bergisch Gladbach - EntwurfHaushalt 2015 Bergisch Gladbach - Entwurf
Haushalt 2015 Bergisch Gladbach - Entwurf
 
Slidershare1
Slidershare1Slidershare1
Slidershare1
 
La retórica en el lenguaje visual
La retórica en el lenguaje visualLa retórica en el lenguaje visual
La retórica en el lenguaje visual
 
Miguel peña copia
Miguel peña   copiaMiguel peña   copia
Miguel peña copia
 
B6 obtenção de matéria (parte ii)
B6   obtenção de matéria (parte ii)B6   obtenção de matéria (parte ii)
B6 obtenção de matéria (parte ii)
 
A cabezazos contra el techo de cristal en #EBE15 Begoña Martínez y Beatriz Se...
A cabezazos contra el techo de cristal en #EBE15 Begoña Martínez y Beatriz Se...A cabezazos contra el techo de cristal en #EBE15 Begoña Martínez y Beatriz Se...
A cabezazos contra el techo de cristal en #EBE15 Begoña Martínez y Beatriz Se...
 
1. cap1 farm general
1. cap1 farm general1. cap1 farm general
1. cap1 farm general
 
Cook ijmbl 2010_preprint
Cook ijmbl 2010_preprintCook ijmbl 2010_preprint
Cook ijmbl 2010_preprint
 
Marketing News 04
Marketing News 04Marketing News 04
Marketing News 04
 
Apache license
Apache licenseApache license
Apache license
 
Presentación Lipo-Body Laser
Presentación Lipo-Body LaserPresentación Lipo-Body Laser
Presentación Lipo-Body Laser
 
Difusores de Gran Caudal de Aire y Conos de Alta Inducción - Serie DCH y CI
Difusores de Gran Caudal de Aire y Conos de Alta Inducción - Serie DCH y CIDifusores de Gran Caudal de Aire y Conos de Alta Inducción - Serie DCH y CI
Difusores de Gran Caudal de Aire y Conos de Alta Inducción - Serie DCH y CI
 
Ygj 02-adhesive-tape-roller
Ygj 02-adhesive-tape-rollerYgj 02-adhesive-tape-roller
Ygj 02-adhesive-tape-roller
 
La inclusión es un verbo.
La inclusión es un verbo.La inclusión es un verbo.
La inclusión es un verbo.
 
Locsateli. Control y Gestion de flotas. Tracking fleet.
Locsateli. Control y Gestion de flotas. Tracking fleet.Locsateli. Control y Gestion de flotas. Tracking fleet.
Locsateli. Control y Gestion de flotas. Tracking fleet.
 
HAY - catalogue 2013 - 2nd edition
HAY - catalogue 2013 - 2nd editionHAY - catalogue 2013 - 2nd edition
HAY - catalogue 2013 - 2nd edition
 
Smlatam Analysis V1
Smlatam Analysis V1Smlatam Analysis V1
Smlatam Analysis V1
 
AISLAMIENTO ACÚSTICO EN VENTANAS
AISLAMIENTO ACÚSTICO EN VENTANASAISLAMIENTO ACÚSTICO EN VENTANAS
AISLAMIENTO ACÚSTICO EN VENTANAS
 
Api presentation
Api presentationApi presentation
Api presentation
 

Similar to ASP.NET 08 - Data Binding And Representation

Chapter 15
Chapter 15Chapter 15
ADO.NET by ASP.NET Development Company in india
ADO.NET by ASP.NET  Development Company in indiaADO.NET by ASP.NET  Development Company in india
ADO.NET by ASP.NET Development Company in india
iFour Institute - Sustainable Learning
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
Aravindharamanan S
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
Aravindharamanan S
 
Ado.Net
Ado.NetAdo.Net
Ado.Net
LiquidHub
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
Mahmoud Ouf
 
2310 b 10
2310 b 102310 b 10
2310 b 10
Krazy Koder
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
Randy Connolly
 
Disconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NETDisconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NET
Everywhere
 
Csharp_dotnet_ADO_Net_database_query.pptx
Csharp_dotnet_ADO_Net_database_query.pptxCsharp_dotnet_ADO_Net_database_query.pptx
Csharp_dotnet_ADO_Net_database_query.pptx
facebookrecovery1
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
dwm042
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
Umar Farooq
 
Intake 37 ef2
Intake 37 ef2Intake 37 ef2
Intake 37 ef2
Mahmoud Ouf
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
Harman Bajwa
 
Nhibernatethe Orm For Net Platform 1226744632929962 8
Nhibernatethe Orm For Net Platform 1226744632929962 8Nhibernatethe Orm For Net Platform 1226744632929962 8
Nhibernatethe Orm For Net Platform 1226744632929962 8
Nicolas Thon
 
Ado.net
Ado.netAdo.net
Ado.net
Iblesoft
 
Ado Presentation
Ado PresentationAdo Presentation
Ado Presentation
Rebecca Peltz
 
WPF and Databases
WPF and DatabasesWPF and Databases
WPF and Databases
Doncho Minkov
 
C++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment InstructionsC++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment Instructions
TawnaDelatorrejs
 
Mvc acchitecture
Mvc acchitectureMvc acchitecture
Mvc acchitecture
laxmi.katkar
 

Similar to ASP.NET 08 - Data Binding And Representation (20)

Chapter 15
Chapter 15Chapter 15
Chapter 15
 
ADO.NET by ASP.NET Development Company in india
ADO.NET by ASP.NET  Development Company in indiaADO.NET by ASP.NET  Development Company in india
ADO.NET by ASP.NET Development Company in india
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
 
Ado.Net
Ado.NetAdo.Net
Ado.Net
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
 
2310 b 10
2310 b 102310 b 10
2310 b 10
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
Disconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NETDisconnected Architecture and Crystal report in VB.NET
Disconnected Architecture and Crystal report in VB.NET
 
Csharp_dotnet_ADO_Net_database_query.pptx
Csharp_dotnet_ADO_Net_database_query.pptxCsharp_dotnet_ADO_Net_database_query.pptx
Csharp_dotnet_ADO_Net_database_query.pptx
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
Intake 37 ef2
Intake 37 ef2Intake 37 ef2
Intake 37 ef2
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
 
Nhibernatethe Orm For Net Platform 1226744632929962 8
Nhibernatethe Orm For Net Platform 1226744632929962 8Nhibernatethe Orm For Net Platform 1226744632929962 8
Nhibernatethe Orm For Net Platform 1226744632929962 8
 
Ado.net
Ado.netAdo.net
Ado.net
 
Ado Presentation
Ado PresentationAdo Presentation
Ado Presentation
 
WPF and Databases
WPF and DatabasesWPF and Databases
WPF and Databases
 
C++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment InstructionsC++ Programming Class Creation Program Assignment Instructions
C++ Programming Class Creation Program Assignment Instructions
 
Mvc acchitecture
Mvc acchitectureMvc acchitecture
Mvc acchitecture
 

More from Randy Connolly

Celebrating the Release of Computing Careers and Disciplines
Celebrating the Release of Computing Careers and DisciplinesCelebrating the Release of Computing Careers and Disciplines
Celebrating the Release of Computing Careers and Disciplines
Randy Connolly
 
Public Computing Intellectuals in the Age of AI Crisis
Public Computing Intellectuals in the Age of AI CrisisPublic Computing Intellectuals in the Age of AI Crisis
Public Computing Intellectuals in the Age of AI Crisis
Randy Connolly
 
Why Computing Belongs Within the Social Sciences
Why Computing Belongs Within the Social SciencesWhy Computing Belongs Within the Social Sciences
Why Computing Belongs Within the Social Sciences
Randy Connolly
 
Ten-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS DegreeTen-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS Degree
Randy Connolly
 
Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)
Randy Connolly
 
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Randy Connolly
 
Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)
Randy Connolly
 
Modern Web Development (2018)
Modern Web Development (2018)Modern Web Development (2018)
Modern Web Development (2018)
Randy Connolly
 
Helping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing DisciplinesHelping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing Disciplines
Randy Connolly
 
Constructing a Web Development Textbook
Constructing a Web Development TextbookConstructing a Web Development Textbook
Constructing a Web Development Textbook
Randy Connolly
 
Web Development for Managers
Web Development for ManagersWeb Development for Managers
Web Development for Managers
Randy Connolly
 
Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"
Randy Connolly
 
17 Ways to Fail Your Courses
17 Ways to Fail Your Courses17 Ways to Fail Your Courses
17 Ways to Fail Your Courses
Randy Connolly
 
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Randy Connolly
 
Constructing and revising a web development textbook
Constructing and revising a web development textbookConstructing and revising a web development textbook
Constructing and revising a web development textbook
Randy Connolly
 
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing DisciplinesComputing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines
Randy Connolly
 
Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...
Randy Connolly
 
Thinking About Technology
Thinking About TechnologyThinking About Technology
Thinking About Technology
Randy Connolly
 
A longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission dataA longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission data
Randy Connolly
 
Web Security
Web SecurityWeb Security
Web Security
Randy Connolly
 

More from Randy Connolly (20)

Celebrating the Release of Computing Careers and Disciplines
Celebrating the Release of Computing Careers and DisciplinesCelebrating the Release of Computing Careers and Disciplines
Celebrating the Release of Computing Careers and Disciplines
 
Public Computing Intellectuals in the Age of AI Crisis
Public Computing Intellectuals in the Age of AI CrisisPublic Computing Intellectuals in the Age of AI Crisis
Public Computing Intellectuals in the Age of AI Crisis
 
Why Computing Belongs Within the Social Sciences
Why Computing Belongs Within the Social SciencesWhy Computing Belongs Within the Social Sciences
Why Computing Belongs Within the Social Sciences
 
Ten-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS DegreeTen-Year Anniversary of our CIS Degree
Ten-Year Anniversary of our CIS Degree
 
Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)Careers in Computing (2019 Edition)
Careers in Computing (2019 Edition)
 
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
Facing Backwards While Stumbling Forwards: The Future of Teaching Web Develop...
 
Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)Where is the Internet? (2019 Edition)
Where is the Internet? (2019 Edition)
 
Modern Web Development (2018)
Modern Web Development (2018)Modern Web Development (2018)
Modern Web Development (2018)
 
Helping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing DisciplinesHelping Prospective Students Understand the Computing Disciplines
Helping Prospective Students Understand the Computing Disciplines
 
Constructing a Web Development Textbook
Constructing a Web Development TextbookConstructing a Web Development Textbook
Constructing a Web Development Textbook
 
Web Development for Managers
Web Development for ManagersWeb Development for Managers
Web Development for Managers
 
Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"Disrupting the Discourse of the "Digital Disruption of _____"
Disrupting the Discourse of the "Digital Disruption of _____"
 
17 Ways to Fail Your Courses
17 Ways to Fail Your Courses17 Ways to Fail Your Courses
17 Ways to Fail Your Courses
 
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
Red Fish Blue Fish: Reexamining Student Understanding of the Computing Discip...
 
Constructing and revising a web development textbook
Constructing and revising a web development textbookConstructing and revising a web development textbook
Constructing and revising a web development textbook
 
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing DisciplinesComputing is Not a Rock Band: Student Understanding of the Computing Disciplines
Computing is Not a Rock Band: Student Understanding of the Computing Disciplines
 
Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...Citizenship: How do leaders in universities think about and experience citize...
Citizenship: How do leaders in universities think about and experience citize...
 
Thinking About Technology
Thinking About TechnologyThinking About Technology
Thinking About Technology
 
A longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission dataA longitudinal examination of SIGITE conference submission data
A longitudinal examination of SIGITE conference submission data
 
Web Security
Web SecurityWeb Security
Web Security
 

Recently uploaded

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 

Recently uploaded (20)

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 

ASP.NET 08 - Data Binding And Representation

  • 1. Chapter 8 Data Binding and Representation It is a capital mistake to theorize before one has data. Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes , “Scandal in Bohemia”
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Data Binding an Array <asp:DropDownList id=&quot;drpSample&quot; runat=&quot;server&quot; /> private void Page_Load(object sender, System.EventArgs e) { string[] names = new string[3] { &quot;Austen&quot;,&quot;Dante&quot;,&quot;Goethe&quot; }; drpSample.DataSource = names; drpSample.DataBind(); }
  • 8.
  • 9.
  • 11.
  • 12. Using an ArrayList ArrayList myList = new ArrayList(); … Customer c1 = new Customer( … ); myList.Add( c1 ); int index = … Customer c = (Customer)myList[index]; // Create sample customer objects Customer c1 = new Customer(&quot;334&quot;, &quot;Thomas&quot;, &quot;Hobbes&quot;, &quot;123-4567&quot;); Customer c2 = new Customer(&quot;123&quot;, &quot;Jean-Jacques&quot;, &quot;Rosseau&quot;, &quot;456-1267&quot;); Customer c3 = new Customer(&quot;085&quot;, &quot;David&quot;, &quot;Hume&quot;, &quot;564-7823&quot;); // Create and populate collection ArrayList myList = new ArrayList(); myList.Add(c1); myList.Add(c2); myList.Add(c3); // Data bind collection to control lboxCustomers.DataSource = myList; lboxCustomers.DataBind();
  • 13. Using an ArrayList <asp:ListBox id=&quot;lboxCustomers&quot; runat=&quot;server&quot; DataTextField=&quot;Name&quot; DataValueField=&quot;Id&quot; />
  • 14.
  • 15.
  • 16. Using Generics List<int> numbers = new List<int>(); List<Customer> customers = new List<Customer>(); numbers.Add(47); customers.Add( new Customer(&quot;085&quot;,&quot;David&quot;,&quot;Hume&quot;,&quot;564-7823&quot;) ); int n = numbers[0]; Customer c = customers[0];
  • 17.
  • 18. Using a Dictionary Dictionary<string, Customer> dict = new Dictionary<string, Customer>(); String id = &quot;085&quot;; Customer c = new Customer(id, &quot;David&quot;, &quot;Hume&quot;, &quot;564-7823&quot;); dict.Add(id, c); … Customer c = dict[key];
  • 19. Using a Dictionary List<Customer> myList = new List<Customer>(); … foreach (Customer c in myList) { if (c.Id == valueToFind) { // Do something with this customer } } Dictionary<string, Customer> dict = new Dictionary<string, Customer>(); Customer c = dict[valueToFind]; if (c != null) { // Do something with this customer }
  • 20. Iterating a Dictionary Dictionary<string, Customer> dict = new Dictionary<string, Customer>(); // This does NOT work foreach (Customer c in dict) Dictionary<string, Customer> dict = new Dictionary<string, Customer>(); // This does work foreach (Customer c in dict.Values ) { labMsg.Text += c.Id + &quot;,&quot; + c.LastName + &quot;<br/>&quot;; }
  • 21.
  • 23.
  • 24.
  • 25. Defining a DataTable DataTable table = new DataTable(); DataColumn firstNameCol = new DataColumn(&quot;FirstName&quot;, typeof(string)); table.Columns.Add(firstNameCol); DataColumn idCol = new DataColumn(); idCol.ColumnName = &quot;Id&quot;; idCol.DataType = typeof(Int32); idCol.AllowDBNull = false; idCol.Unique = true; table.Columns.Add(idCol);
  • 26. Filling the DataTable DataRow r1 = table.NewRow(); r1[0] = 1; r1[1] = &quot;Thomas&quot;; r1[2] = &quot;Hobbes&quot;; r1[3] = &quot;123-4567&quot;; table.Rows.Add(r1); DataRow r2 = table.NewRow(); r2[&quot;Id&quot;] = 2; r2[&quot;FirstName&quot;] = &quot;David&quot;; r2[&quot;LastName&quot;] = &quot;Hume&quot;; r2[&quot;Phone&quot;] = &quot;564-7823&quot;; table.Rows.Add(r2);
  • 27. Using a DataSet DataSet ds = new DataSet(); DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); … ds.Tables.Add( dt1 ); ds.Tables.Add( dt2 ); DataTable t1 = ds.Tables[0]; DataTable t2 = ds.Tables[1]; ds.Tables[0].TableName = &quot;Cust&quot;; … DataTable dt = ds.Tables[&quot;Cust&quot;]; DataRow dr = ds.Tables[0].Rows[0]; string s1 = (string)dr[1]; string s2 = (string)dr[&quot;Phone&quot;]; string s3 = (string)ds.Tables[0].Rows[0][&quot;Phone&quot;];
  • 28.
  • 29. XML Integration try { DataSet ds = new DataSet(); ds.ReadXml( Server.MapPath(&quot;~/App_Data/somefile.xml&quot;) ); // Use the data set } catch (IOException) { // Handle the error } ds.WriteXml(&quot;output.xml&quot;);
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.