建立固定表頭、表格體滾動的DataGrid (轉)
建立固定表頭、表格體滾動的DataGrid (轉)[@more@].mengxianhui.com.ShowFixedHeader"%>
w3c//DTD HTML 4.0 Transitional//EN">
microsoft .NET 7.0">
7.0">
script">
intellisense/">
RM id="Form1" method="post" runat="server">
Public Class ShowFixedHeader
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 lucky_elove As HtmlControls.HtmlGenericControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
buggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System., 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
lucky_elove.InnerText = "【孟憲會之精彩世界】 - 跨欄表頭的實現"
Table1.Rows(0).Cells(0).InnerText = "【孟憲會之精彩世界】.NET版本之最新文章"
Table1.Rows(0).Cells(1).InnerText = "文章資訊"
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('')")
Table1.Rows(0).Cells(0).Style.Add("cursor", "hand")
Try
Dim cnString As String = "Provr=Microsoft.Jet.OLEDB.4.0;Data ="_
+ Server.MapPath("Test.mdb")
Dim cn As New OleDbConnection(cnString)
cn.Open()
Dim str As String = " TOP 30 D.Title,D.CreateDate,S.Title as pid,D.HitCount "_
+ "FROM Document D INNER JOIN Subject S ON D.pid = S.id 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 > 26 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, 26) + "…"
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
建立固定表頭、表格體滾動的DataGrid
playground.com/">孟子E章
在使用DataGrid時,有時候需要表頭表頭固定、表格體的內容可以滾動,下面的程式碼就是實現這個功能的程式碼。
x" target=_blank>檢視例子
ShowFixedHeader.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10748419/viewspace-991314/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 用CSS實現的固定表頭的HTML表格CSSHTML
- 表格拖動滾動條標題固定程式碼例項
- asp.net table表格表頭及列固定實現ASP.NET
- js 固定表頭及固定列的jsJS
- laravel-admin 表格固定頭部Laravel
- 一種區域性固定表頭的實現方案(橫向可跟隨內容一同滾動,縱向鎖定表頭)
- excel表格如何凍結工作表的固定行?Excel
- web簡單頁面佈局fixed 頭部固定 內容滾動Web
- 表格顯示滾動條
- html css 如何將表頭固定HTMLCSS
- Excel中表頭表尾固定列印Excel
- Excel如何列印固定表頭和表尾Excel
- 動態建立表格
- table表頭固定例項程式碼
- EasyUI - DataGrid 去右邊空白滾動條列UI
- excel表頭怎麼固定每頁列印都有 excel表頭怎麼固定每頁都有顯示Excel
- JavaScript動態建立表格和增加表格的行JavaScript
- 滑鼠滾動固定js(jquery)例項分享JSjQuery
- Silverlight DataGrid 多重表頭實現
- 如何鎖定excel表頭兩行 excel每頁固定表頭列印Excel
- EasyUI-DataGrid去右邊空白滾動條列UI
- 固定表頭和首列,防抖節流
- elementui 當表格有固定列,拖動條在固定列的範圍內時拖拽不動UI
- ASP.NET Aries DataGrid 配置表頭說明文件ASP.NET
- 報表展現時如何實現固定表頭效果
- 建立表空間、回滾段、使用者、表的詳細語法資訊(轉)
- Laravel-admin 表格新增滾動條Laravel
- 兩種動態建立表格的方法
- JavaScript 動態建立table表格JavaScript
- JavaScript動態建立table表格JavaScript
- 仿騰訊課堂固定滾動列表ReactNative元件React元件
- 拉鍊表的建立、查詢和回滾
- 讓系統自動生成表頭的方法(轉)
- Easyui datagrid 實現表格記錄拖拽UI
- jquery easyui DataGrid 資料表格 屬性jQueryUI
- 動態固定行轉列
- [轉帖]DataGrid顯示雙層表頭,即可實現合併單元格問題
- WPF隨筆收錄-DataGrid固定右側列