0% found this document useful (0 votes)
35 views

Home Page

This document provides an overview of ASP.NET, including its introduction, benefits, and common controls. ASP.NET is a server-side web application framework developed by Microsoft that allows programmers to build dynamic web sites, applications, and services. It supports multiple programming languages and uses a common language runtime. ASP.NET separates program content and logic, which simplifies maintenance. It has an extensive class library and is well-suited for developing web applications. Common ASP.NET controls include web server controls, data controls, validation controls, navigation controls, and AJAX controls. The document also discusses connecting ASP.NET to databases.

Uploaded by

manimozhi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Home Page

This document provides an overview of ASP.NET, including its introduction, benefits, and common controls. ASP.NET is a server-side web application framework developed by Microsoft that allows programmers to build dynamic web sites, applications, and services. It supports multiple programming languages and uses a common language runtime. ASP.NET separates program content and logic, which simplifies maintenance. It has an extensive class library and is well-suited for developing web applications. Common ASP.NET controls include web server controls, data controls, validation controls, navigation controls, and AJAX controls. The document also discusses connecting ASP.NET to databases.

Uploaded by

manimozhi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

ASP.

NET

Prepared By,

S. Manimozhi,
Assistant Professor,
Department of Computer Applications
Bon Secours College for Women,
Thanjavur
SUBSTANCES

 Introduction
 ASP.NET & Benefits
 ASP. NET Controls
 Web server controls

 Data Controls

 Validation Controls

 Navigation controls

 Ajax Controls

 ASP .NET with Database Connectivity


Introduction

Scripting Languages

Server Side Client Side

Programs on the web that are


executed client-side, Programs that runs a scripting
by the user's web browser. language is a web server.

PHP JavaScript (primarily)


ASP. Net in C#, C++, or VB HTML
ASP uses JavaScript CSS
Action Script
VBScript
Introduction

 Developed by Microsoft to allow programmers to

build dynamic web sites, web applications and web


services.

 Released in the year Jan.2002 Version 1.0

 It is an open source, server side scripting language.

 It is a case sensitive language.


Benefits of ASP. NET

 Supports multiple programming languages.

 Server side scripting language

 Common language Runtime

 Content and program logic are separated which reduces

the inconveniences of the program maintenance.

 Enormous class library.

 Well defined software for web applications.


ASP.NET Controls
 Web Server Controls 
Web server controls are also created on the server and they require a runat="server"
attribute to work. However, Web server controls do not necessarily map to any existing
HTML elements and they may represent more complex elements.
 Data Controls 
Data Source controls, which allow you to set properties for connections to database or
XML data sources, and Data controls, which allow you to display data from data sources
specified in Data Source controls.
 Validation Controls 
A Validation server control is used to validate the data of an input control. If the data
does not pass validation, it will display an error message to the user.
 Navigation Controls 
A navigation structure can provide a clear organization for each and every file even if
they are put into the same physical directory.
 Ajax Controls 
AJAX stands for Asynchronous JavaScript and XML. This is a cross platform
technology which speeds up response time.
Web server controls

Label Textbox Button Checkbox

Checkbox list Dropdown list List box Radio button

Radio button list Image Control Hyperlink Panel Control

Hidden Field Calendar Control File Upload Link Button

Bulleted list Ad rotator Image map Literal

Localize Multi view Place Holder Substitution

View Wizard XML Image Button


How to use controls?
Control Command Event  Image Control

Label label1.Text label1.Text  Hyperlink--


response.redire
Textbox textbox.Text
ct(“”);
Button Button1.Click()  Panel Control –
Checkbox checkbox1.Selected visible
item.Text  Hidden Field –
Checkbox list checkboxlist.Select hidden
editem.text field1.value=“”;
 Calendar
Dropdown list DropEmpName.Ite DropEmpName.S
ms.Add electedItem.Text Control
 File Upload
List box listbox1.Selectedi
tem.text
Radio button Radiobuttonlist1.
selecteditem.text
Radio button
list
Data & Validation controls

Data list Grid view

Details View Form View

Compare Validator Custom Validator Range Validator

Required Field Validation Summary Regular


Validator Expression
Validator
Navigation & Ajax controls

Tree View Menu Control Sitemap Path Control

Script Manager Timer

Update Panel Calendar


ASP.Net With DB Connectivity

 SqlConnection conb = new


SqlConnection(ConfigurationManager.ConnectionSt
rings["Connect1"].ToString());

 Header Files
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.IO;
SQL command with web page interaction

 Insert
 con.Open();
SqlCommand adp = new SqlCommand(
“ insert into table_name values
('" + this.txtpapertitle.Text + "','" + this.txtauthorname.Text +
"')“ , con);

adp.ExecuteNonQuery();
con.Close();
SQL command with web page interaction

 Update
con.Open();

SqlCommand cmd = new SqlCommand("Update table_name SET NAME


='" + this.txtname.text + "' where Coursecode='" + txtccode.Text + “’", con);

cmd.ExecuteNonQuery();

con.Close();
SQL command with web page interaction

 Delete
 con.Open();
SqlCommand cmd = new SqlCommand(“delete from
table_name where NAME ='" + this.txtname.text + "' where
Coursecode='" + txtccode.Text + “’", con);

cmd.ExecuteNonQuery();
con.Close();
SQL command with web page interaction
 Select Command
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM course WHERE (year = '“ +
TEXTBOX1.TEXT + "„ ) order by Degreeshortform,Typrofpgm desc", con);

DataSet ds= new DataSet();

da.Fill(ds);

DataTable dt = new DataTable();

dt.Columns.Add("S.No");

dt.Columns.Add("Degree");

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)

DataRow dr = dt.NewRow();

dr["Degree"]=ds.Tables[0].Rows[i][0].ToString();

dt.Rows.Add(dr);

GridView1.DataSource = dt;

GridView1.DataBind();
SQL command with web page interaction
 Select

SqlDataAdapter adp3 = new SqlDataAdapter("select * from table_name


", con);

DataTable tbl3 = new DataTable();

adp3.Fill(tbl3);

this.GridView1.DataSource = tbl3;

this.GridView1.DataBind();
Sql command with count

SqlCommand cmd2 = new SqlCommand("select *


from login where username ='" + txtusername.Text +
"' and pwd='" + txtpassword.Text + “’", con);
ad = new SqlDataAdapter(cmd2);
DataTable dt2 = new DataTable();
ad.Fill(dt2);
if (dt.Rows.Count > 0)
{
Session["id"] = txtusername.Text.ToString();
Response.Redirect("~/.aspx");
}
Redirections between web pages

 Response.Redirect(Request.RawUrl);
 Response.Redirect("16.1_Home.aspx");
 ClientScript.RegisterStartupScript(Type.GetType("Sy
stem.String"), "Message", "<script
language='javascript'>alert('Data Added
Successfully);</script>");

 Session[“no”]=“23..”;
 this.hdempid.Value = Session[“no"].ToString();
Database with Controls
Dropdown list
SqlDataAdapter ad1 = new SqlDataAdapter("Select distinct batchfrom HRM where dcode='" + coursecode + "'", con);
DataSet ds1 = new DataSet();
ad1.Fill(ds1);
if (ds1.Tables[0].Rows.Count > 0)
{
ddlreg.Items.Clear();
ddlreg.Items.Add("Select Regulation");
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
ddlreg.Items.Add(ds1.Tables[0].Rows[i][0].ToString());
}
}

Label
SqlDataAdapter ad = new SqlDataAdapter("Select StudentName from stud where appno='" + textbox1.Text+ "'' ",
con);
DataSet ds = new DataSet();
ad.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
lblname.Text = ds.Tables[0].Rows[0][0].ToString();
}
Thank You

You might also like