惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
B
Blog
N
Netflix TechBlog - Medium
量子位
月光博客
月光博客
博客园_首页
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
M
MIT News - Artificial intelligence
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
腾讯CDC
Engineering at Meta
Engineering at Meta
云风的 BLOG
云风的 BLOG
L
LangChain Blog
GbyAI
GbyAI
IT之家
IT之家
Y
Y Combinator Blog
人人都是产品经理
人人都是产品经理

博客园 - Suntears

InputBox函数用法 MsgBox用法 【转】我的悲哀——虽然是转载,但同样是我自己的悲哀 javascript中keyCode代码对应表(函数实现) - Suntears - 博客园 asp.net+ajax多线程进度条的实现 - Suntears - 博客园 asp.net进度条的实现(附demo) asp.net进度条的实现(纯个人收藏) 高度获得相关代码 - Suntears - 博客园 c#去除url中的param参数的函数 - Suntears - 博客园 如何实现js的重载 临时让别人登录你的qq邮箱,却又不想让他知道密码的方法 在url中去除指定参数的c#代码 asp.net中面向对象传值方法 如何在webform.aspx.cs中控制用户控件的属性 如何让一个iframe自动调整大小 eBay起家 如何向用户控件传递参数 [转]asp.net中窗口相关操作总结(javascript) [转]JavaScript页面跳转常用代码
asp.net中将DataTable根据xslt生成html静态页面,支持分页
Suntears · 2007-05-17 · via 博客园 - Suntears

功能很单一,也不是很完善~~,虚心听各位的教诲*^_^*
代码如下:

有两种使用方法。
第一种:实例化时初始化数据,例:

        private void Page_Load(object sender, System.EventArgs e)
        
{
            
// 在此处放置用户代码以初始化页面
            string strSql="Select c.CRM_ID,c.crm_cn,c.CRM_TYPE_ID login_name From crm c Where c.status='0'";
            OracleDb conn
=new OracleDb();
            DataTable dt
=new DataTable();
            dt
=conn.GetDtRecorder(strSql);
            
string strAPath=Request.PhysicalApplicationPath;
            
string strXmlname=strAPath+"xsltdemo\\crm.xml";
            
string strHtmlname=strAPath+"xsltdemo\\crm.html";
            
string strXSLTname=strAPath+"xsltdemo\\crm.xslt";
            xmlhtml sh
=new xmlhtml(dt,strXmlname,strHtmlname,strXSLTname,100);
            sh.StaticHtml();
            sh.Dispose();
        }

代码
xmlhtml sh=new xmlhtml(dt,strXmlname,strHtmlname,strXSLTname,100)
dt是提供数据源的datatable,strXmlname是中间生成的xml文件的路径,strHtmlname是生成的静态html页面路径,strXSLTname是xslt样式表的路径,100是分页后每页代码显示的记录行数。
注:最后的页面尺寸参数可以不加,默认整个数据表显示到一个页面。

第二种:实例化后直接使用StaticHtml方法。最后三行为

            xmlhtml sh=new xmlhtml();
            sh.StaticHtml(dt,strXmlname,strHtmlname,strXSLTname,
100);
            sh.Dispose();

demo下载