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

Asp.net.
Asp.net.Asp.net.
Asp.net.
Naveen Sihag
 
Web forms in ASP.net
Web forms in ASP.netWeb forms in ASP.net
Web forms in ASP.net
Madhuri Kavade
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
Webtech Learning
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
Rajkumarsoy
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
BG Java EE Course
 
CSS
CSSCSS
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
Lanh Le
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
MUKALU STEVEN
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
Taha Malampatti
 
Form validation client side
Form validation client side Form validation client side
Form validation client side
Mudasir Syed
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
Asp net
Asp netAsp net
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
Mindy McAdams
 
html5.ppt
html5.ppthtml5.ppt
html5.ppt
Niharika Gupta
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
Bhumivaghasiya
 
J2ee
J2eeJ2ee
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
Adil Mehmoood
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
SQLITE Android
SQLITE AndroidSQLITE Android
SQLITE Android
Sourabh Sahu
 

What's hot (20)

Asp.net.
Asp.net.Asp.net.
Asp.net.
 
Web forms in ASP.net
Web forms in ASP.netWeb forms in ASP.net
Web forms in ASP.net
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
HTML: Tables and Forms
HTML: Tables and FormsHTML: Tables and Forms
HTML: Tables and Forms
 
CSS
CSSCSS
CSS
 
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
 
Form validation client side
Form validation client side Form validation client side
Form validation client side
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
Asp net
Asp netAsp net
Asp net
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 
html5.ppt
html5.ppthtml5.ppt
html5.ppt
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
 
J2ee
J2eeJ2ee
J2ee
 
Swing and AWT in java
Swing and AWT in javaSwing and AWT in java
Swing and AWT in java
 
JavaScript - Chapter 15 - Debugging Techniques
 JavaScript - Chapter 15 - Debugging Techniques JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 15 - Debugging Techniques
 
SQLITE Android
SQLITE AndroidSQLITE Android
SQLITE Android
 

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
 
Chapter 3: ado.net
Chapter 3: ado.netChapter 3: ado.net
Chapter 3: ado.net
Ngeam Soly
 
Ado.Net
Ado.NetAdo.Net
Ado.Net
LiquidHub
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
Madhuri Kavade
 
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
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
Iblesoft
 

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
 
Chapter 3: ado.net
Chapter 3: ado.netChapter 3: ado.net
Chapter 3: ado.net
 
Ado.Net
Ado.NetAdo.Net
Ado.Net
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
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
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
 

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

Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
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
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
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
 
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
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
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
 
“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
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 

Recently uploaded (20)

Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
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
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
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
 
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
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
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
 
“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...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 

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.