选择显示字体大小

一个asp.net+xml留言本例子

viewpost.aspx--察看提交的留言
viewguestbook.aspx--察看所有留言
header.inc
guestpost.aspx--留言表单及xml写操作
footer.inc
guest.xml--xml数据

源代码如下:

viewguestbook.aspx
<%@ import namespace="system" %>
<%@ import namespace="system.io" %>
<%@ import namespace="system.data" %>
<%@ assembly name="system.xml" %>
<%@ import namespace="system.xml" %>
<%@ page language="c<%-- needed assembiles --%>

<html>
<head>
<title>welcome to saurabh's guestbook.</title>
<script language="c //run the script when the page is loaded
public void page_load(object sender, eventargs e)
{
// an label , its use stated later
tryagain :

//the path to the xml file which will contain all the data
//modify this if you have any other file or directory mappings.
//modify this if you have been directed here from step 2 of the readme file.
string datafile = "db/guest.xml" ;

//try-catch block to read from an xml file
try
{
//make an instance to the xmldatadocument class
//this class can read from an xml file in and ordered format
xmldatadocument datadoc = new xmldatadocument();

// infer the dataset schema from the xml data and load the xml data
datadoc.dataset.readxml(new streamreader(server.mappath(datafile)));

//databind the first table in the dataset to the repeter
mydatalist.datasource = datadoc.dataset.tables[0].defaultview;
mydatalist.databind();

//free up the xml file to be used by other programs
datadoc=null;


}
catch(ioexception ed)
{
// here i am for now trying to overcome a bug in my guestbook exapmle
//the bug is that only one class can either read or write to my xml
// data file at a time.
//if the file is being used my some some other page (eg the guest book viewing page)
// then an ioexception will be thrown
// so to handle such situtations what we do is that
// if an ioexception is thrown the page goes again to the tryagain label
//and tries to write again into the xml file
//this goes on till finally the resource is freed and the xml file is written to.

goto tryagain ;
}
catch (exception edd)
{
//catch any other exceptions that occur
errmess.text="cannot read from xml file because "+edd.tostring() ;
}



}


</script>
<link href="mystyle.css" type=text/css rel=stylesheet>

</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" rightmargin="0">
<!-- <asp:label id="errmess" text="" style="color:<br>
<h3 align="center" class="newsbody">my guestbook.</h3>
<asp:repeater id="mydatalist" runat="server">

<template name="headertemplate">

<table class="mainheads" width="100%" style="font: 8pt verdana">
<tr style="background-color: <th>
name
</th>
<th>
country
</th>
<th>
email
</th>
<th>
comments
</th>
<th>
date/time
</th>
</tr>

</template>

<template name="itemtemplate">

<tr style="background-color: <td>
<% </td>
<td>
<% </td>
<td>
<% </td>


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons