SlideShare uma empresa Scribd logo
1 de 30
Table of contents
 Introduction to VS 2005
 Application and Page Frameworks
 GUI Controls
 Validation Server Controls
 Working with Master Pages
 Themes & Skins
 Collections & Lists
 Data Binding
 Data Management with ADO.Net
 Working with XML
 Site Navigation
 Security
 State Management
 Caching
 Debugging & Error Handling
 File I/O & Streams
 Configurations
 All web application will have a master page
or a home page
 If we hit a website the default page that
comes is the home page
 It will have the name index.html or
default.aspx or home.html or some thing
like that.
 From this master page, we navigate to the
rest of the pages through buttons or links
 To set a page as the master page all we
need to do is, just right click on the aspx
page in the solution explorer and select “Set
as Start Page” from the pop up menu.
 Themes and Skins provide a good look and
feel to our site or web application.
 We can set the theme using CSS (Cascading
Style Sheet)
 In the <HEAD> portion of our aspx page if
we give <link href=“css path” type=“text/css”
rel=“stylesheet”> then the particular style
specified in the CSS will be used for the page
 We can also allow the user to change the skin
(color of controls on the application) and
dynamically deliver the theme and skin on his
browser.
 This is achieved using session variables.
 Once the user selects a skin,the value is
stored in a session variable and it will be used
for the session.
 If the user want the same skin to be applied
whenever he logs in, there are two ways to
achieve that.
◦ Cookies – The information will be stored on the
client’s system and will be taken when he logs in
from the system again. But this will work only in a
particular system
◦ To make this global, the information need to be
stored on the server, in a table against the user
name.
 Compilation units that let you organize and
reuse code
 No relationship between namespaces and
file structure (unlike Java)
 Namespaces provide a way to uniquely
identify a type
 Provides logical organization of types
 Namespaces can span over assemblies
 Namespaces can be nested
 The fully qualified name of a type includes
all namespaces
 The fully qualified name of a type includes all namespaces
 Namespaces are mainly used to distinguish between the
objects having same names
 With-in a namespace, the names of all the objects should be
unique
namespace N1 {// is referred to as N1
class C1 { // is referred to as N1.C1
class C2 { // is referred to as N1.C1.C2
} //End of N1.C1.C2
} //End of N1.C1
namespace N2 { // is referred to as N1.N2
class C2 { // is referred to as N1.N2.C2
} // End of N1.N2.C2
} //End of N1.N2
} //End of N1
 A collection is a specialized class that organizes and exposes
a group of objects
 Various collection classes are ArrayList, SortedList, BitArray,
HashTable, Queue and Stack
 They are all included in System.Collections namespace
 Like arrays, members of collections can be accessed by an
index
 Unlike arrays, collections can be resized dynamically
 Arraylist allows to dynamically add and
remove items from a simple list
 Array List is a zero based collection
 The items in the list are retrieved by
accessing the item index
 Methods
◦ Add()
◦ Remove()
◦ RemoveAt()
◦ Count()
 Property
◦ Capacity
 Stores elements in the collection as a key-value pair that are
sorted by the keys
 The elements in the SortedList can be accessed by key as well
as by index
 A key cannot be a null reference whereas a value can be a null
reference
 Any time when an element is added or removed from the
collection, the indexes are adjusted to keep the list in the
sorted order. Hence such operations are slower in this
collection
 Methods
◦ Add()
◦ Remove()
◦ RemoveAt()
◦ Count()
 Property
◦ Count, Capacity, Item, Keys, Values
 Bounding values to the controls
 <<Control>>.DataBind() method binds
values for the control
 Page.DataBind() binds all the controls on the
page
 Types
◦ Single value data binding
◦ Multi value data binding
Softsmith Infotech
 Applicable for server controls that displays
one data at a time
 Controls like
◦ Textbox
◦ Label
 Involves binding server controls to ArrayList
or SortedList or any collection object
 Example
◦ Populating a drop down list with a collection object
or a data set
◦ Populating a Data grid with a data set
 ADO – ActiveX Data Objects
 Namespace
◦ System.Data
 Types
 Odbc – For working with MySQL etc
 OleDb – For working with OLEDB (Excel etc)
 Sql – For working with MS SQL data bases
 Oracle – For working with Oracle databases
 Classes used (for Sql)
◦ Connection - SqlConnection
◦ Command - SqlCommand
◦ DataReader - SqlDataReader
◦ DataAdapter – SqlDataAdapter
For other database types, we need to put the
appropriate prefix.(like OdbcConnection and so on)
Softsmith Infotech
 OdbcConnection con = new
OdbcConnection(Connection string)
 Connection string has details about which
database is to be used and what is the user
name and password are.
 Example –
“Driver={MySQL ODBC 3.51
Driver};SERVER=localhost;DATABASE=test; password=sa;user
id=root;”
 Open – Opens a connection
 Close – Closes a connection
 It is recommended to open a connection only
if it is needed and close it when it is no
longer needed. This would avoid wastage of
system resources
 OdbcCommand cmd = new
OdbcCommand(Query, con);
 Query – SQL query like “select * from table1”
 con is the connection object created
 Command object property
◦ CommandType – This can be text or stored
procedure or table
 OdbcDataReader dr = new
OdbcDataReader();
 Usage - dr.Method
 DataReader Methods:
◦ ExecuteReader – For reading one or more rows
(for select * from…)
◦ ExecuteScalar – For reading a scalar value like
select count(*) from …
◦ ExecuteNonQuery – for inserting or updating or
deleting or executing a stored procedure or
function
 This is for filling data from more than one
tables
 The data get filled into a DataSet
 OdbcDataAdapter da = new
OdbcDataAdapter(cmd)
 cmd – command object created using the
connection and SQL statement
 This will fetch the result of the command and
stores it in the adapter
 To put the data in a dataset, use the Fill
method
 da.Fill(ds) – DataSet ds = new DataSet()
 We can also have DataTable or DataRow or
DataView instead of DataSet
 Data adapter automatically opens and closes
a connection. No need of having explicit open
and close of a connection.
 XML – eXtensible Markup Language
 Uses
◦ XML can be used to Store Data
◦ XML is used to create configuration
files for different applications
◦ XML is used to Exchange Data in
cross-platform applications
◦ Used in Web applications
Softsmith Infotech
 System.Xml namespace is required
 Opening from an URL
XmlDocument myDoc = new XmlDocument();
myDoc.Load ("http://localhost/sample.xml");
 Opening from a location in the local system
XmlDocument myDoc = new XmlDocument();
FileStream myFile = new
FileStream("myDoc.xml",FileMode.Open);
myDoc.Load(myFile);
myFile.Close();
 XmlElement – Class for accessing individual
elements in a xml file
◦ Attributes, FirstChild, LastChild, InnerText,
InnerXml, Name
 XmlAttribute – Class for accessing attributes
of the individual xml elements
◦ Name
◦ Value
 To get the name and values of attributes in a xml file
/* Get the Attribute Collection */
XmlAttributeCollection attrs = myElement.Attributes;
/* Get the number of Attributes */
int aCount = attrs.Count;
for (i=0; i< aCount; i++)
{
Console.WriteLine (attrs[i].Name);
Console.WriteLine (attrs[i].Value);
}
 Create XML Document object
XmlDocument myDoc = new XmlDocument();
 Load the root element
myDoc.LoadXml ("<webinar></webinar>");
 Create an element and add it to the parent
element
XmlElement myChildEle =
myDoc.CreateElement(“Topic");
myChildEle.InnerText = “Dot Net";
ParentElement.AppendChild (myChildEle);
 Create an attribute
XmlAttribute myAttribute =
myDoc.CreateAttribute(“Trainer");
myAttribute.Value = “Softsmith";
 Add it to Parent element
ParentElement.SetAttributeNode (myAttribute);
XML file will be
<webinar>
<Topic Trainer=“Softsmith”>Dot Net</Topic>
</webinar>
 XmlReader – To read an XML file
 XmlWriter – To write Xml to a file (creating
xml)
 XmlReader
string filename=@"books.xml";
XmlTextReader bookXmlReader = new XmlTextReader (filename);
 XmlWriter
string fileName = @"booksnew.xml";
XmlTextWriter bookXmlWriter = new
XmlTextWriter(fileName,null);
public void ReadDocument (XmlReader xmlR)
{
try {
// read (pull) the next node in document order
while (xmlR.Read()) {
// print the current node's name & type
Console.WriteLine(xmlR.NodeType + " " +
xmlR.Name);
}
}
catch(XmlException e) {
Console.WriteLine ("Error: " + e.Message);
}
}
public void WriteDocument(XmlWriter writer)
{
writer.WriteStartDocument();
writer.WriteStartElement ("Person");
writer.WriteAttributeString ("Gender", "Male");
writer.WriteAttributeString ("Name", "Abc");
writer.WriteElementString ("Phone", "111-222-3333");
writer.WriteElementString ("Phone", "111-222-4444");
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
}
Output:
<?xml version=“1.0”?>
<Person>
<Phone>111-222-3333</Phone>
<Phone>111-222-4444</Phone>
</Person>

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Ado.net
Ado.netAdo.net
Ado.net
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Xml serialization
Xml serializationXml serialization
Xml serialization
 
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
 
REST Basics
REST BasicsREST Basics
REST Basics
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
 
.Net Project Portfolio for Roger Loving
.Net Project Portfolio for Roger Loving.Net Project Portfolio for Roger Loving
.Net Project Portfolio for Roger Loving
 
For Beginners - Ado.net
For Beginners - Ado.netFor Beginners - Ado.net
For Beginners - Ado.net
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
Database Programming
Database ProgrammingDatabase Programming
Database Programming
 
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
 
Chapter 3: ado.net
Chapter 3: ado.netChapter 3: ado.net
Chapter 3: ado.net
 
Oracle basic queries
Oracle basic queriesOracle basic queries
Oracle basic queries
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
Mysql
MysqlMysql
Mysql
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 

Destaque

Simple xml in .net
Simple xml in .netSimple xml in .net
Simple xml in .netVi Vo Hung
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet frameworkNitu Pandey
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NETrchakra
 
Validation controls in asp
Validation controls in aspValidation controls in asp
Validation controls in aspShishir Jain
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net frameworkArun Prasad
 
ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1Kumar S
 

Destaque (6)

Simple xml in .net
Simple xml in .netSimple xml in .net
Simple xml in .net
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
 
Validation controls in asp
Validation controls in aspValidation controls in asp
Validation controls in asp
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1
 

Semelhante a ASP.Net Presentation Part2

ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12Sisir Ghosh
 
An overview of snowflake
An overview of snowflakeAn overview of snowflake
An overview of snowflakeSivakumar Ramar
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And XmlDavid Truxall
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net ArchitectureUmar Farooq
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code FirstJames Johnson
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2ADARSH BHATT
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRPeter Elst
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actionsAren Zomorodian
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web appsIvano Malavolta
 
Jdbc Java Programming
Jdbc Java ProgrammingJdbc Java Programming
Jdbc Java Programmingchhaichivon
 
Software development - the java perspective
Software development - the java perspectiveSoftware development - the java perspective
Software development - the java perspectiveAlin Pandichi
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
Asp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxAsp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxsridharu1981
 

Semelhante a ASP.Net Presentation Part2 (20)

ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12
 
An overview of snowflake
An overview of snowflakeAn overview of snowflake
An overview of snowflake
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
 
Ado
AdoAdo
Ado
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
La sql
La sqlLa sql
La sql
 
Entity Framework Database and Code First
Entity Framework Database and Code FirstEntity Framework Database and Code First
Entity Framework Database and Code First
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
 
Web Technologies - forms and actions
Web Technologies -  forms and actionsWeb Technologies -  forms and actions
Web Technologies - forms and actions
 
Local storage in Web apps
Local storage in Web appsLocal storage in Web apps
Local storage in Web apps
 
Jdbc Java Programming
Jdbc Java ProgrammingJdbc Java Programming
Jdbc Java Programming
 
JDBC in Servlets
JDBC in ServletsJDBC in Servlets
JDBC in Servlets
 
Software development - the java perspective
Software development - the java perspectiveSoftware development - the java perspective
Software development - the java perspective
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Oracle notes
Oracle notesOracle notes
Oracle notes
 
PPT temp.pptx
PPT temp.pptxPPT temp.pptx
PPT temp.pptx
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
Asp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxAsp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptx
 
treeview
treeviewtreeview
treeview
 

Último

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

ASP.Net Presentation Part2

  • 1. Table of contents  Introduction to VS 2005  Application and Page Frameworks  GUI Controls  Validation Server Controls  Working with Master Pages  Themes & Skins  Collections & Lists  Data Binding  Data Management with ADO.Net  Working with XML  Site Navigation  Security  State Management  Caching  Debugging & Error Handling  File I/O & Streams  Configurations
  • 2.  All web application will have a master page or a home page  If we hit a website the default page that comes is the home page  It will have the name index.html or default.aspx or home.html or some thing like that.  From this master page, we navigate to the rest of the pages through buttons or links  To set a page as the master page all we need to do is, just right click on the aspx page in the solution explorer and select “Set as Start Page” from the pop up menu.
  • 3.  Themes and Skins provide a good look and feel to our site or web application.  We can set the theme using CSS (Cascading Style Sheet)  In the <HEAD> portion of our aspx page if we give <link href=“css path” type=“text/css” rel=“stylesheet”> then the particular style specified in the CSS will be used for the page
  • 4.  We can also allow the user to change the skin (color of controls on the application) and dynamically deliver the theme and skin on his browser.  This is achieved using session variables.  Once the user selects a skin,the value is stored in a session variable and it will be used for the session.
  • 5.  If the user want the same skin to be applied whenever he logs in, there are two ways to achieve that. ◦ Cookies – The information will be stored on the client’s system and will be taken when he logs in from the system again. But this will work only in a particular system ◦ To make this global, the information need to be stored on the server, in a table against the user name.
  • 6.  Compilation units that let you organize and reuse code  No relationship between namespaces and file structure (unlike Java)  Namespaces provide a way to uniquely identify a type  Provides logical organization of types  Namespaces can span over assemblies  Namespaces can be nested  The fully qualified name of a type includes all namespaces
  • 7.  The fully qualified name of a type includes all namespaces  Namespaces are mainly used to distinguish between the objects having same names  With-in a namespace, the names of all the objects should be unique namespace N1 {// is referred to as N1 class C1 { // is referred to as N1.C1 class C2 { // is referred to as N1.C1.C2 } //End of N1.C1.C2 } //End of N1.C1 namespace N2 { // is referred to as N1.N2 class C2 { // is referred to as N1.N2.C2 } // End of N1.N2.C2 } //End of N1.N2 } //End of N1
  • 8.  A collection is a specialized class that organizes and exposes a group of objects  Various collection classes are ArrayList, SortedList, BitArray, HashTable, Queue and Stack  They are all included in System.Collections namespace  Like arrays, members of collections can be accessed by an index  Unlike arrays, collections can be resized dynamically
  • 9.  Arraylist allows to dynamically add and remove items from a simple list  Array List is a zero based collection  The items in the list are retrieved by accessing the item index  Methods ◦ Add() ◦ Remove() ◦ RemoveAt() ◦ Count()  Property ◦ Capacity
  • 10.  Stores elements in the collection as a key-value pair that are sorted by the keys  The elements in the SortedList can be accessed by key as well as by index  A key cannot be a null reference whereas a value can be a null reference  Any time when an element is added or removed from the collection, the indexes are adjusted to keep the list in the sorted order. Hence such operations are slower in this collection  Methods ◦ Add() ◦ Remove() ◦ RemoveAt() ◦ Count()  Property ◦ Count, Capacity, Item, Keys, Values
  • 11.  Bounding values to the controls  <<Control>>.DataBind() method binds values for the control  Page.DataBind() binds all the controls on the page  Types ◦ Single value data binding ◦ Multi value data binding Softsmith Infotech
  • 12.  Applicable for server controls that displays one data at a time  Controls like ◦ Textbox ◦ Label
  • 13.  Involves binding server controls to ArrayList or SortedList or any collection object  Example ◦ Populating a drop down list with a collection object or a data set ◦ Populating a Data grid with a data set
  • 14.  ADO – ActiveX Data Objects  Namespace ◦ System.Data  Types  Odbc – For working with MySQL etc  OleDb – For working with OLEDB (Excel etc)  Sql – For working with MS SQL data bases  Oracle – For working with Oracle databases
  • 15.  Classes used (for Sql) ◦ Connection - SqlConnection ◦ Command - SqlCommand ◦ DataReader - SqlDataReader ◦ DataAdapter – SqlDataAdapter For other database types, we need to put the appropriate prefix.(like OdbcConnection and so on) Softsmith Infotech
  • 16.  OdbcConnection con = new OdbcConnection(Connection string)  Connection string has details about which database is to be used and what is the user name and password are.  Example – “Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test; password=sa;user id=root;”
  • 17.  Open – Opens a connection  Close – Closes a connection  It is recommended to open a connection only if it is needed and close it when it is no longer needed. This would avoid wastage of system resources
  • 18.  OdbcCommand cmd = new OdbcCommand(Query, con);  Query – SQL query like “select * from table1”  con is the connection object created  Command object property ◦ CommandType – This can be text or stored procedure or table
  • 19.  OdbcDataReader dr = new OdbcDataReader();  Usage - dr.Method  DataReader Methods: ◦ ExecuteReader – For reading one or more rows (for select * from…) ◦ ExecuteScalar – For reading a scalar value like select count(*) from … ◦ ExecuteNonQuery – for inserting or updating or deleting or executing a stored procedure or function
  • 20.  This is for filling data from more than one tables  The data get filled into a DataSet  OdbcDataAdapter da = new OdbcDataAdapter(cmd)  cmd – command object created using the connection and SQL statement  This will fetch the result of the command and stores it in the adapter
  • 21.  To put the data in a dataset, use the Fill method  da.Fill(ds) – DataSet ds = new DataSet()  We can also have DataTable or DataRow or DataView instead of DataSet  Data adapter automatically opens and closes a connection. No need of having explicit open and close of a connection.
  • 22.  XML – eXtensible Markup Language  Uses ◦ XML can be used to Store Data ◦ XML is used to create configuration files for different applications ◦ XML is used to Exchange Data in cross-platform applications ◦ Used in Web applications Softsmith Infotech
  • 23.  System.Xml namespace is required  Opening from an URL XmlDocument myDoc = new XmlDocument(); myDoc.Load ("http://localhost/sample.xml");  Opening from a location in the local system XmlDocument myDoc = new XmlDocument(); FileStream myFile = new FileStream("myDoc.xml",FileMode.Open); myDoc.Load(myFile); myFile.Close();
  • 24.  XmlElement – Class for accessing individual elements in a xml file ◦ Attributes, FirstChild, LastChild, InnerText, InnerXml, Name  XmlAttribute – Class for accessing attributes of the individual xml elements ◦ Name ◦ Value
  • 25.  To get the name and values of attributes in a xml file /* Get the Attribute Collection */ XmlAttributeCollection attrs = myElement.Attributes; /* Get the number of Attributes */ int aCount = attrs.Count; for (i=0; i< aCount; i++) { Console.WriteLine (attrs[i].Name); Console.WriteLine (attrs[i].Value); }
  • 26.  Create XML Document object XmlDocument myDoc = new XmlDocument();  Load the root element myDoc.LoadXml ("<webinar></webinar>");  Create an element and add it to the parent element XmlElement myChildEle = myDoc.CreateElement(“Topic"); myChildEle.InnerText = “Dot Net"; ParentElement.AppendChild (myChildEle);
  • 27.  Create an attribute XmlAttribute myAttribute = myDoc.CreateAttribute(“Trainer"); myAttribute.Value = “Softsmith";  Add it to Parent element ParentElement.SetAttributeNode (myAttribute); XML file will be <webinar> <Topic Trainer=“Softsmith”>Dot Net</Topic> </webinar>
  • 28.  XmlReader – To read an XML file  XmlWriter – To write Xml to a file (creating xml)  XmlReader string filename=@"books.xml"; XmlTextReader bookXmlReader = new XmlTextReader (filename);  XmlWriter string fileName = @"booksnew.xml"; XmlTextWriter bookXmlWriter = new XmlTextWriter(fileName,null);
  • 29. public void ReadDocument (XmlReader xmlR) { try { // read (pull) the next node in document order while (xmlR.Read()) { // print the current node's name & type Console.WriteLine(xmlR.NodeType + " " + xmlR.Name); } } catch(XmlException e) { Console.WriteLine ("Error: " + e.Message); } }
  • 30. public void WriteDocument(XmlWriter writer) { writer.WriteStartDocument(); writer.WriteStartElement ("Person"); writer.WriteAttributeString ("Gender", "Male"); writer.WriteAttributeString ("Name", "Abc"); writer.WriteElementString ("Phone", "111-222-3333"); writer.WriteElementString ("Phone", "111-222-4444"); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); } Output: <?xml version=“1.0”?> <Person> <Phone>111-222-3333</Phone> <Phone>111-222-4444</Phone> </Person>

Notas do Editor

  1. Softsmith Infotech