富贵资源网 Design By www.hznty.com
标签定义
复制代码 代码如下:
public class Encoding
{
public string Encode(string cSource)
{
return System.Web.HttpUtility.HtmlEncode(cSource);
}
}
public class EmList : Label
{
public override bool EnableViewState
{
get{ return false;}
}
public string XslFile{get;set;}
public object SerialObject{get;set;}
protected override void Render(HtmlTextWriter writer)
{
if (SerialObject == null)
{
throw new Exception("对象未初始化");
}
System.Xml.Serialization.XmlSerializer oSerial = new System.Xml.Serialization.XmlSerializer(SerialObject.GetType());
System.Text.StringBuilder oSb = new System.Text.StringBuilder();
System.IO.StringWriter oWr = new System.IO.StringWriter(oSb);
string Xml = "";
oSerial.Serialize(oWr, SerialObject);
Xml =oSb.ToString();
string cXslFileName = this.MapPathSecure(XslFile);
if (!System.IO.File.Exists(cXslFileName))
{
throw new Exception("请加自己的处理异常程序");
}
System.Xml.Xsl.XsltArgumentList xslArgs = new System.Xml.Xsl.XsltArgumentList();
Encoding oEn = new Encoding();
xslArgs.AddExtensionObject("urn:Encoding", oEn);
System.Xml.XmlDocument oDoc = new System.Xml.XmlDocument();
try
{
oDoc.LoadXml(Xml);
}
catch
{
throw new Exception("请加自己的处理异常程序");
}
System.Xml.Xsl.XslCompiledTransform oTran = new System.Xml.Xsl.XslCompiledTransform();
string cXsl = "";
try
{
cXsl = System.IO.File.ReadAllText(cXslFileName);
}
catch
{
throw new Exception("请加自己的处理异常程序");
}
System.IO.StringReader oSr=new System.IO.StringReader(cXsl);
System.Xml.XmlReader oRe=System.Xml.XmlReader.Create(oSr);
try
{
oTran.Load(oRe);
}
catch
{
throw new Exception("请加自己的处理异常程序");
}
try
{
oTran.Transform(oDoc, xslArgs, writer);
}
catch
{
throw new Exception("请加自己的处理异常程序");
}
}
}
public class PageBar : System.Web.UI.HtmlControls.HtmlControl
{
public int PageNum{get;set;}
public int PageSize { get; set; }
public int PageCount { get; set; }
public string BaseUrl{get;set;}
protected override void Render(HtmlTextWriter writer)
{
writer.Write(string.Format("<a href={0}?PageNum=1>第一页</a>|<a href={0}?PageNum={1}>上一页</a>|<a href={0}?PageNum={2}>下一页</a>|<a href={0}?PageNum={3}>尾页</a> (共{4}当前页{5})", BaseUrl, PageNum - 1 > 0 ? PageNum - 1 : 1, PageNum + 1 > PageCount ? PageCount : PageNum + 1, PageCount, PageCount, PageNum));
}
}
页面定义
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@Register TagPrefix="CS" Namespace="WebApplication1.Control" Assembly=" WebApplication1" %>
<!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></title>
</head>
<body>
<CS:EmList SerialObject="<%#List%>" XslFile="XSL/test.xslt" runat="server" /><br />
<CS:PageBar PageNum="<%#PageNum%>" BaseUrl="<%#Request.Path%>" PageCount="5" runat="server" />
</body>
</html>
其中List和PageNum为页面属性
XSLT:
复制代码 代码如下:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:Encoding="urn:Encoding">
<xsl:output method="text" />
<xsl:template match="/">
<h2>
<xsl:for-each select="ArrayOfEmployeeEntity/EmployeeEntity">
<![CDATA[<a href="https://www.jb51.net/article/9720.htm]]><xsl:value-of select="Encoding:Encode(EmployeeID)"/><![CDATA[" alt="]]><xsl:value-of select= "Encoding:Encode(Full_Name)"/><![CDATA["><br/>]]><xsl:value-of select= "Encoding:Encode(Email_Address)"/></xsl:for-each>
</h2>
</xsl:template>
</xsl:stylesheet>
复制代码 代码如下:
public class Encoding
{
public string Encode(string cSource)
{
return System.Web.HttpUtility.HtmlEncode(cSource);
}
}
public class EmList : Label
{
public override bool EnableViewState
{
get{ return false;}
}
public string XslFile{get;set;}
public object SerialObject{get;set;}
protected override void Render(HtmlTextWriter writer)
{
if (SerialObject == null)
{
throw new Exception("对象未初始化");
}
System.Xml.Serialization.XmlSerializer oSerial = new System.Xml.Serialization.XmlSerializer(SerialObject.GetType());
System.Text.StringBuilder oSb = new System.Text.StringBuilder();
System.IO.StringWriter oWr = new System.IO.StringWriter(oSb);
string Xml = "";
oSerial.Serialize(oWr, SerialObject);
Xml =oSb.ToString();
string cXslFileName = this.MapPathSecure(XslFile);
if (!System.IO.File.Exists(cXslFileName))
{
throw new Exception("请加自己的处理异常程序");
}
System.Xml.Xsl.XsltArgumentList xslArgs = new System.Xml.Xsl.XsltArgumentList();
Encoding oEn = new Encoding();
xslArgs.AddExtensionObject("urn:Encoding", oEn);
System.Xml.XmlDocument oDoc = new System.Xml.XmlDocument();
try
{
oDoc.LoadXml(Xml);
}
catch
{
throw new Exception("请加自己的处理异常程序");
}
System.Xml.Xsl.XslCompiledTransform oTran = new System.Xml.Xsl.XslCompiledTransform();
string cXsl = "";
try
{
cXsl = System.IO.File.ReadAllText(cXslFileName);
}
catch
{
throw new Exception("请加自己的处理异常程序");
}
System.IO.StringReader oSr=new System.IO.StringReader(cXsl);
System.Xml.XmlReader oRe=System.Xml.XmlReader.Create(oSr);
try
{
oTran.Load(oRe);
}
catch
{
throw new Exception("请加自己的处理异常程序");
}
try
{
oTran.Transform(oDoc, xslArgs, writer);
}
catch
{
throw new Exception("请加自己的处理异常程序");
}
}
}
public class PageBar : System.Web.UI.HtmlControls.HtmlControl
{
public int PageNum{get;set;}
public int PageSize { get; set; }
public int PageCount { get; set; }
public string BaseUrl{get;set;}
protected override void Render(HtmlTextWriter writer)
{
writer.Write(string.Format("<a href={0}?PageNum=1>第一页</a>|<a href={0}?PageNum={1}>上一页</a>|<a href={0}?PageNum={2}>下一页</a>|<a href={0}?PageNum={3}>尾页</a> (共{4}当前页{5})", BaseUrl, PageNum - 1 > 0 ? PageNum - 1 : 1, PageNum + 1 > PageCount ? PageCount : PageNum + 1, PageCount, PageCount, PageNum));
}
}
页面定义
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@Register TagPrefix="CS" Namespace="WebApplication1.Control" Assembly=" WebApplication1" %>
<!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></title>
</head>
<body>
<CS:EmList SerialObject="<%#List%>" XslFile="XSL/test.xslt" runat="server" /><br />
<CS:PageBar PageNum="<%#PageNum%>" BaseUrl="<%#Request.Path%>" PageCount="5" runat="server" />
</body>
</html>
其中List和PageNum为页面属性
XSLT:
复制代码 代码如下:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:Encoding="urn:Encoding">
<xsl:output method="text" />
<xsl:template match="/">
<h2>
<xsl:for-each select="ArrayOfEmployeeEntity/EmployeeEntity">
<![CDATA[<a href="https://www.jb51.net/article/9720.htm]]><xsl:value-of select="Encoding:Encode(EmployeeID)"/><![CDATA[" alt="]]><xsl:value-of select= "Encoding:Encode(Full_Name)"/><![CDATA["><br/>]]><xsl:value-of select= "Encoding:Encode(Email_Address)"/></xsl:for-each>
</h2>
</xsl:template>
</xsl:stylesheet>
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?