ASP.NET 从xml读出数据时的分页方法
public string GetPage(int page, int pages, string url)
{
if (pages == 0)
{
pages = 1;
}
string sb0 = "";
int n1 = 0, n2 = 0;
n1 = page - 5 <= 0 ? 1 : page - 5;
n2 = page + 5 > pages ? pages : page + 5;
if (n2 <= 9)
n2 = 10;
if (n2 > pages)
n2 = pages;
if (n2 - n1 < 9)
n1 = n2 - 9 < 1 ? 1 : n2 - 9;
sb0 += " <a href=\"" + url + 1 + ".html\">首页</a> ";
sb0 += "<a href=\"" + url + (page - 1 <= 0 ? 1 : page - 1)
+ ".html\">上一页</a> ";
//判断是否是当前页
for (; n1 <= n2; n1++)
&
相关文档:
asp.net 页面延时五秒,跳转到另外的页面的实现代码。
--前台
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Successed.aspx.cs" Inherits="Biz_Order_Successed" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xht ......
Standards
"DTD" was the first formalized standard, but is rarely used anymore.
"XDR" was an early attempt by Microsoft to provide a more comprehensive standard than DTD. This standard has pretty much been abandoned now in favor of XSD.
"XSD" is currently the de facto standard for describing XML d ......
一般xml中如果含有&等字符,可以通过CDATA来过滤,但是含有一些不认识的特殊字符时候就会不起作用,下面是从别人那儿拿来的一个过滤方
法,过滤xml中的非法字符:
//XML标准规定的无效字节为:
/*
0×00 – 0×08
0×0b – 0×0c
0×0e – 0×1f
* ......
在ASP.NET中我们经常需要输出一些JS脚本,比如弹出一个警告窗口,返回到历史页面等JS功能,我看到网上好多这方面的代码,以下代码是其中之一。
整个程序的代码如下:
复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
/// &l ......
刚刚接触网页开发,不过遇到URR参数传递错误的问题,两个页面进行信息交互时可以用url进行传递,但是如果传递信息的编码格式不是UTF-8(或者不是设置的默认格式)URL传递时会出现乱码。
比如你传入汉字,或者传入"§”等其他编码格式的字符串系统解析后的url为乱码。经过在网上的查找觉得一下两种方式比较好:
1 ......