国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

XP 風(fēng)格的可拖動(dòng)列、排序的DataGrid的例子

2024-07-21 02:23:11
字體:
供稿:網(wǎng)友
本文介紹xp 風(fēng)格的可拖動(dòng)列、排序的datagrid的例子,請(qǐng)查看

要想使用本源代碼,請(qǐng)先下載如下文件:

downarrow.gif
sortblank.gif
sortup.gif
sortdown.gif
uparrow.gif
xptable.css
xptable.htc

源代碼如下:【c#版本】

dragablexpstyletable.aspx

<%@ page language="c#" codebehind="dragablexpstyletable.aspx.cs"
autoeventwireup="false" inherits="emeng.exam.dragablexpstyletable.dragablexpstyletable" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>xp 風(fēng)格的可拖動(dòng)列、排序的datagrid的例子</title>
<meta name="generator" content="microsoft visual studio 7.0">
<meta name="code_language" content="c#">
<link rel="stylesheet" type="text/css" href="xptable.css">
<meta name="vs_defaultclientscript" content="javascript">
<meta name="vs_targetschema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body ms_positioning="gridlayout">
<form id="dragablexpstyletable" method="post" runat="server">
<div align="center" style="padding:20px"><b>xp 風(fēng)格的可拖動(dòng)列、排序的datagrid的例子。</b></div>
<asp:datagrid id="xptable" runat="server" autogeneratecolumns="false" cellpadding="2"
borderwidth="0" borderstyle="none" style="border-collapse:separate" width="90%" cssclass="xptable">
<headerstyle horizontalalign="center"></headerstyle>
<columns>
<asp:boundcolumn itemstyle-height="22" datafield="title" sortexpression="title"
headertext="文章標(biāo)題"
headerstyle-font-bold="true"></asp:boundcolumn>
<asp:boundcolumn datafield="createdate" sortexpression="createdate"
headertext="創(chuàng)建日期" headerstyle-font-bold="true"
dataformatstring="{0:yyyy年mm月dd日 hh:mm:ss}"></asp:boundcolumn>
<asp:boundcolumn datafield="subtitle" sortexpression="subtitle"
headertext="所屬欄目" headerstyle-font-bold="true"></asp:boundcolumn>
</columns>
</asp:datagrid>
</form>
</body>
</html>

dragablexpstyletable.aspx.cs

using system;
using system.collections;
using system.componentmodel;
using system.data;
using system.drawing;
using system.web;
using system.web.sessionstate;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.htmlcontrols;
using system.data.oledb;

namespace emeng.exam.dragablexpstyletable
{
/// <summary>
/// dragablexpstyletable 的摘要說明。
/// xp風(fēng)格的可拖動(dòng)的datagrid
/// </summary>
public class dragablexpstyletable : system.web.ui.page
{
protected system.web.ui.webcontrols.datagrid xptable;

private void page_load(object sender, system.eventargs e)
{
// 在此處放置用戶代碼以初始化頁面
xptable.attributes.add("altrowcolor","oldlace");
xptable.attributes.add("align","center");
string cnstring = "provider=microsoft.jet.oledb.4.0;data source=";
cnstring += system.web.httpcontext.current.server.mappath("testtable.mdb")
oledbconnection cn = new oledbconnection(cnstring);
cn.open();
cnstring = "select top 15 d.title,d.createdate,s.title as subtitle ";
cnstring += "from document d,subject s where d.pid=s.id order by d.createdate desc";
oledbcommand cmd = new oledbcommand(cnstring,cn);
xptable.datasource=cmd.executereader(commandbehavior.closeconnection);
xptable.databind();
cmd.dispose();
cn.close();
cn.dispose();
cn = null;
}

#region web form designer generated code
override protected void oninit(eventargs e)
{
//
// codegen:該調(diào)用是 asp.net web 窗體設(shè)計(jì)器所必需的。
//
initializecomponent();
base.oninit(e);
}

/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void initializecomponent()
{
this.load += new system.eventhandler(this.page_load);

}
#endregion
}
}

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 武乡县| 清徐县| 望谟县| 泰和县| 原平市| 霍州市| 阿图什市| 紫云| 南乐县| 温泉县| 宝清县| 遂昌县| 台前县| 泰兴市| 南和县| 阳新县| 仲巴县| 申扎县| 瑞安市| 绵竹市| 乌审旗| 鱼台县| 伊金霍洛旗| 凤山县| 兰溪市| 蓝山县| 托里县| 崇文区| 克拉玛依市| 河南省| 长沙县| 荆州市| 绍兴市| 和田市| 丹棱县| 洛南县| 郎溪县| 扶沟县| 自贡市| 鲁甸县| 弥渡县|