Softsmith Infotech.Net Table of contents Introduction to VS 2005 Application and Page Frameworks GUI Controls Validation Server Controls Working with Master.

Slides:



Advertisements
Similar presentations
Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
Advertisements

Mobile Development Storing State with XML Rob Miles Department of Computer Science.
Direct Data Access, Data Binding. Content Direct Data Access Data Binding Muzaffer DOĞAN - Anadolu University2.
Internetteknologi (ITNET2) Presentation 21: ASP.NET Advanced.
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
Introduction to Database Processing with ADO.NET.
1 Chapter 12 Working With Access 2000 on the Internet.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
Stored Procedures Dr. Ralph D. Westfall May, 2009.
Some Basic Database Terminology
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
ASP.Net Web Applications. Characteristics of a typical data driven web application Web Server HTML Graphics Active-X Java Applets HTTP Request ADO / JDBC.
Chapter 81 Building Data-Driven Web Applications Introduction to ASP.NET By Kathleen Kalata.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
1 ASP.NET ASP.NET Rina Zviel-Girshin Lecture 4. 2 Overview Data Binding Data Providers Data Connection Data Manipulations.
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
CIS 375—Web App Dev II ASP.NET 10 Database 2. 2 Introduction to Server-Side Data Server-side data access is unique in that Web pages are basically ___________.
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
Databases and Data Access  Introduction to ADO.NET  ADO.NET objects  ADP.NET namespaces  Differences between ADO and ADO.NET.
.NET Data Access and Manipulation ADO.NET. Overview What is ADO.NET? Disconnected vs. connected data access models ADO.NET Architecture ADO.NET Core Objects.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
Delivering Excellence in Software Engineering ® EPAM Systems. All rights reserved. Data Binding in ASP.NET.
ASP.NET Rina Zviel-Girshin Lecture 5
Session 8: ADO.NET. Overview Overview of ADO.NET What is ADO.NET? Using Namespaces The ADO.NET Object Model What is a DataSet? Accessing Data with ADO.NET.
Module 7: Accessing Data by Using ADO.NET
1 Data Classes- DataView DataGridView Control. Objectives 2  Data Class  DataAdapter  DataReader  DataSet  DataTable  DataView  DataGridView Control.
TRAINING SESSIONS.NET Controls.  Standard Controls  Label  Textbox  Checkbox  Button, Image Button, Image control  Radio Button  Literal  Hyperlink.
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
HNDIT Rapid Application Development
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
Module 4 Introduction ADO.NET.
C# .NET Software Development
Active Data Objects Using.Net ADO.Net Farooq Ahmed Amna Umber Summayya Shehzad.
VB.Net. Topics Introduction to VB.Net Creating VB.Net Project in VS 2005 Data types and Operators in VB.Net String Functions Conditions (If Else, Select.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
.NET Data Access and Manipulation
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
ASP.NET Programming with C# and SQL Server First Edition
Introduction to ADO.NET
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
ADO.NET Framework.
Programming the Web Using ASP.Net
Lecture 6 VB.Net SQL Server.
Unit 9.2 Database access from code Database Cycle Review
VB.NET Using Database.
Chapter 23 – ASP.NET Outline 23.1 Introduction NET Overview
Tonga Institute of Higher Education
Brief description on how to navigate within this presentation (ppt)
Chapter 10 ADO.
Database Applications
Chapter 10 Accessing Database Files
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Softsmith Infotech.Net 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

Softsmith Infotech Working with Master Pages 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.

Softsmith Infotech Themes and Skins 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 portion of our aspx page if we give then the particular style specified in the CSS will be used for the page

Softsmith Infotech Themes and Skins 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.

Softsmith Infotech Themes and Skins 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.

Softsmith Infotech Namespaces 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

Softsmith Infotech 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

Softsmith Infotech Collections 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

Softsmith Infotech ArrayList 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

Softsmith Infotech SortedList 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

Softsmith Infotech Data Binding Bounding values to the controls >.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 Single Value Data Binding Applicable for server controls that displays one data at a time Controls like –Textbox –Label

Softsmith Infotech Multi Value Data Binding 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

Softsmith Infotech Data Management with ADO.Net 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

Softsmith Infotech Data Management 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 Connection 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;”

Softsmith Infotech Connection Methods 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

Softsmith Infotech Command 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

Softsmith Infotech DataReader 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

Softsmith Infotech DataAdapter 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

Softsmith Infotech DataAdapter 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.

Softsmith Infotech Working with XML 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 Opening an XML System.Xml namespace is required Opening from an URL XmlDocument myDoc = new XmlDocument(); myDoc.Load (" 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();

Softsmith Infotech Reading the XML document 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

Softsmith Infotech Example 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); }

Softsmith Infotech Writing XML Create XML Document object XmlDocument myDoc = new XmlDocument(); Load the root element myDoc.LoadXml (" "); Create an element and add it to the parent element XmlElement myChildEle = myDoc.CreateElement(“Topic"); myChildEle.InnerText = “Dot Net"; ParentElement.AppendChild ( myChildEle );

Softsmith Infotech Writing XML Create an attribute XmlAttribute myAttribute = myDoc.CreateAttribute(“Trainer"); myAttribute.Value = “Softsmith"; Add it to Parent element ParentElement.SetAttributeNode (myAttribute); XML file will be Dot Net

Softsmith Infotech XmlReader and XmlWriter XmlReader – To read an XML file XmlWriter – To write Xml to a file (creating xml) XmlReader string XmlTextReader bookXmlReader = new XmlTextReader (filename); XmlWriter string fileName XmlTextWriter bookXmlWriter = new XmlTextWriter(fileName,null);

Softsmith Infotech XmlReader Example 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); }

Softsmith Infotech XmlWriter Example public void WriteDocument(XmlWriter writer) { writer.WriteStartDocument(); writer.WriteStartElement ("Person"); writer.WriteAttributeString ("Gender", "Male"); writer.WriteAttributeString ("Name", "Abc"); writer.WriteElementString ("Phone", " "); writer.WriteElementString ("Phone", " "); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); } Output: