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

首頁 > 編程 > .NET > 正文

vb.net_asp.net跨欄表頭_滾動表體的DataGrid的實現

2024-07-10 13:00:54
字體:
來源:轉載
供稿:網友
showfixheader.aspx
<%@ page language="vb" enableviewstate="false" autoeventwireup="false" codebehind="showfixheader.aspx.vb" inherits="vb1.showfixheader"%>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title id="northsnow_title" runat="server"></title>
<meta name="generator" content="microsoft visual studio.net 7.0">
<meta name="code_language" content="visual basic 7.0">
<meta name="vs_defaultclientscript" content="javascript">
<meta name="vs_targetschema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body ms_positioning="gridlayout" leftmargin="0">
<table align="center">
<tr>
<td>
<form id="form1" method="post" runat="server">
<table id="table1" runat="server" cellspacing="1" cellpadding="2" width="720" border="1"
bgcolor="#cc6633" bordercolor="#cc9966" style="font-size:9pt;border-bottom:0px">
<tr align="center">
<td colspan="2" width="430"></td>
<td width="190" colspan="2"></td>
</tr>
<tr align="center">
<td width="360" bgcolor="#66cc99"></td>
<td width="180" bgcolor="white"></td>
<td width="140" bgcolor="#99cccc"></td>
<td width="40" bgcolor="#009999"></td>
</tr>
</table>
<div style="border:0px;padding:0px;margin:0px;overflow:auto;width:736px;height:200px">
<asp:datagrid id="datagrid1" width="720px" cellpadding="2" cellspacing="1"
bordercolor="#cc9966" font-size="9pt" alternatingitemstyle-backcolor="#6699ff"
runat="server" showheader="false" autogeneratecolumns="false">
<columns>
<asp:boundcolumn datafield="title">
<itemstyle width="360px"></itemstyle>
</asp:boundcolumn>
<asp:boundcolumn datafield="createdate">
<itemstyle width="180px" horizontalalign="center"></itemstyle>
</asp:boundcolumn>
<asp:boundcolumn datafield="author">
<itemstyle width="140px" horizontalalign="center"></itemstyle>
</asp:boundcolumn>
<asp:boundcolumn datafield="hitcount">
<itemstyle width="40px" horizontalalign="center"></itemstyle>
</asp:boundcolumn>
</columns>
</asp:datagrid>
</div>
</form>
</td>
</tr>
</table>
</body>
</html>
showfixheader.aspx.vb
imports system
imports system.data
imports system.data.oledb
public class showfixheader
inherits system.web.ui.page
protected withevents table1 as system.web.ui.htmlcontrols.htmltable
protected withevents datagrid1 as system.web.ui.webcontrols.datagrid
protected withevents form1 as system.web.ui.htmlcontrols.htmlform
protected withevents northsnow_title as htmlcontrols.htmlgenericcontrol
#region " web form designer generated code "
'this call is required by the web form designer.
<system.diagnostics.debuggerstepthrough()> private sub initializecomponent()
end sub
private sub page_init(byval sender as system.object, byval e as system.eventargs) handles mybase.init
'codegen: this method call is required by the web form designer
'do not modify it using the code editor.
initializecomponent()
end sub
#end region
private sub page_load(byval sender as system.object, byval e as system.eventargs) handles mybase.load
northsnow_title.innertext = "northsnow home - 跨欄表頭,滾動表體的datagrid的實現"
table1.rows(0).cells(0).innertext = "northsnow home article"
table1.rows(0).cells(1).innertext = "vb.net + asp.net"
table1.rows(1).cells(0).innertext = "文章標題"
table1.rows(1).cells(1).innertext = "發布時間"
table1.rows(1).cells(2).innertext = "文章作者"
table1.rows(1).cells(3).innertext = "點擊率"
table1.rows(0).style.add("color", "white")
table1.rows(0).style.add("font-weight", "bold")
table1.rows(0).cells(0).attributes.add("onclick", "window.open('http://blog.csdn.net/precipitant/')")
table1.rows(0).cells(0).style.add("cursor", "hand")
try
dim cnstring as string = "provider=microsoft.jet.oledb.4.0;data source=" + server.mappath("test.mdb")
dim cn as new oledbconnection(cnstring)
cn.open()
dim strsql as string = "select top 30 title,createdate,author,hitcount " + "from document order by createdate desc"
dim cmd as new oledbcommand(strsql, cn)
datagrid1.datasource = cmd.executereader
datagrid1.databind()
cn.close()
cn = nothing
catch eole as oledbexception
response.write("產生錯誤:" + eole.message)
end try
end sub
private sub datagrid1_itemdatabound(byval sender as object, _
byval e as system.web.ui.webcontrols.datagriditemeventargs) handles datagrid1.itemdatabound
if e.item.itemtype = listitemtype.item or e.item.itemtype = listitemtype.alternatingitem then
if e.item.cells(0).text.length > 20 then
e.item.cells(0).attributes.add("title", e.item.cells(0).text)
e.item.cells(0).text = e.item.cells(0).text.substring(0, 20) + "…"
end if
e.item.cells(1).text = format(system.convert.todatetime(e.item.cells(1).text), "yyyy年m月d日 h點m分s秒")
end if
end sub
end class



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 云龙县| 安乡县| 买车| 大石桥市| 雷山县| 保靖县| 泰安市| 象州县| 斗六市| 包头市| 江阴市| 定南县| 南安市| 奈曼旗| 龙门县| 长乐市| 龙川县| 宝清县| 丰顺县| 庄河市| 建水县| 明水县| 油尖旺区| 临江市| 丹凤县| 玛多县| 浮山县| 肇州县| 阿克苏市| 河间市| 陇南市| 新和县| 洱源县| 武乡县| 县级市| 宁都县| 三门县| 徐汇区| 牙克石市| 华池县| 富宁县|