A COMPLETE PROGRAM CODE IN ASP.NET CSHARP FOR PHONE BOOK APPLICATION |
This code was tested ok. Simply copy these three files in a folder and run it and you will get the output as shown below.
|
Code for phonebook.xml |
<?xml version="1.0" encoding="utf-8"?>
<guestbook> <record> <name>raja</name> <email>raja@roja.com</email> <mobile>99688888</mobile> </record> <record> <name>roja</name> <email>roaja@pooja.com</email> <mobile>9968996877</mobile> </record> </guestbook> |
Code for phonebook.aspx |
<%@ Page Language="C#"
AutoEventWireup="true" Debug="true" CodeFile="phonebook.aspx.cs"
Inherits="phonebook" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Phone Book</title> </head> <body> <form id="form1" runat="server"> <table border="1" bgcolor="#f0f0f0"> <tr> <td style="width: 100px"> Name:</td> <td style="width: 100px"> <asp:TextBox ID="txtName" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 100px"> Email:</td> <td style="width: 100px"> <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td> </tr> <tr> <td style="width: 100px"> Mobile:</td> <td style="width: 100px"> <asp:TextBox ID="txtMobile" runat="server"></asp:TextBox></td> </tr> <tr> <td colspan="2"> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" /></td> </tr> </table> <br /> Name: <%# DataBinder.Eval(Container.DataItem, "name")
%><br /> |
Code for phonebook.aspx.cs |
using System;
using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Xml; public partial class phonebook : System.Web.UI.Page protected void Button1_Click(object sender, EventArgs e) // Create new XML element and populate its attributes // Insert data into the XML doc and save // Re-bind data since the doc has been added to void BindData() PhoneBook.DataSource = myDataSet.Tables[0]; |
The things I learnt while I migrated from classic asp to asp.net is given here for my reference as well as for new beginners.
INDEX
-
▼
2009
(17)
-
▼
January
(17)
- The Very First Video Tutorial for ASP.NET C#
- Your First Csharp Code
- PHONE BOOK PROGRAM CODE IN ASP.NET CSHARP
- SINGLE DIMENTIONAL ARRAY C#
- TWO DIMENTIONAL ARRAY C# CODE
- ASP.NET CODING FOR REPEATER CONTROL
- ASP.NET-CSHARP-XML-AS-DATABASE
- LISTBOX LESSON 2 HOW TO MOVE DATA FROM LISTBOX TO ...
- ASP.NET-CSHARP-DROPDOWNLIST-EDIT FORM-SOURCE CODE
- What is AuotEventWireup and how to use it
- How to Create HyperLink in a Data Grid
- Login Form - Code in ASP.NET Csharp
- What is ADO.NET | Data Provider | DataSet
- CSHARP command parameter concepts
- Why @ symbol is used in string
- ExecuteScalar ExecuteReader ExecuteNonQuery : What...
- HASH TABLE VS SCRIPTING DICTIONARY
-
▼
January
(17)
PHONE BOOK PROGRAM CODE IN ASP.NET CSHARP
Related Links
Thanks for Your Visit
|
||
| ||
Disclaimer and Copy Right |