...FunctionCreateDataSource()AsICollectionDimdtAsSystem.Data.DataTabl" />

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

ASP.NET 2.0中合并 GridView 的表頭單元格

系統 2958 0

<% ... @PageLanguage = " VB " %>

<! DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

< script runat ="server" > ...
FunctionCreateDataSource()AsICollection
DimdtAsSystem.Data.DataTable
= NewSystem.Data.DataTable
DimdrAsSystem.Data.DataRow
dt.Columns.Add(NewSystem.Data.DataColumn(
" 學生姓名 " ,GetType(System.String)))
dt.Columns.Add(NewSystem.Data.DataColumn(
" 語文 " ,GetType(System.Decimal)))
dt.Columns.Add(NewSystem.Data.DataColumn(
" 數學 " ,GetType(System.Decimal)))
dt.Columns.Add(NewSystem.Data.DataColumn(
" 英語 " ,GetType(System.Decimal)))
DimiAsInteger
= 0
Fori
= 0 To 7
DimrdAsSystem.Random
= NewSystem.Random(Environment.TickCount * i)

dr
= dt.NewRow
dr(
0 ) = " 學生 " + i.ToString
dr(
1 ) = System.Math.Round(rd.NextDouble * 100 , 2 )
dr(
2 ) = System.Math.Round(rd.NextDouble * 100 , 2 )
dr(
3 ) = System.Math.Round(rd.NextDouble * 100 , 2 )
dt.Rows.Add(dr)
Next
DimdvAsSystem.Data.DataView
= NewSystem.Data.DataView(dt)
Returndv
EndFunction

ProtectedSubPage_Load(ByValsenderAsObject,ByValeAsEventArgs)
IfNotIsPostBackThen
GridView1.BorderColor
= System.Drawing.Color.DarkOrange
GridView1.DataSource
= CreateDataSource()
GridView1.DataBind()
EndIf
EndSub

ProtectedSubGridView1_RowCreated(ByValsenderAsObject,ByValeAsGridViewRowEventArgs)
Ife.Row.RowType
= DataControlRowType.HeaderThen
DimrowHeaderAsGridViewRow
= NewGridViewRow( 0 , 0 ,DataControlRowType.Header,DataControlRowState.Normal)
rowHeader.BackColor
= System.Drawing.Color.White
rowHeader.Font.Bold
= True
DimcellsAsTableCellCollection
= e.Row.Cells
DimheaderCellAsTableCell
= NewTableCell
headerCell.Text
= ""
rowHeader.Cells.Add(headerCell)
headerCell
= NewTableCell
headerCell.Text
= " 學生成績 "
headerCell.ColumnSpan
= cells.Count - 1
headerCell.HorizontalAlign
= HorizontalAlign.Center
rowHeader.Cells.Add(headerCell)
rowHeader.Visible
= True
GridView1.Controls(
0 ).Controls.AddAt( 0 ,rowHeader)
EndIf
EndSub

ProtectedSubGridView1_RowDataBound(ByValsenderAsObject,ByValeAsGridViewRowEventArgs)
e.Row.Attributes.Add(
" style " , " background:#FFF " )
EndSub

</ script >

< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< title > 合并GridView的表頭單元格 </ title >
</ head >
< body >
< form id ="Form1" runat ="server" >
< asp:GridView ID ="GridView1" runat ="server" CellSpacing ="1" CellPadding ="3"
Font-Size
="12px" Width ="300px" BackColor ="orange" BorderWidth ="0"
OnRowDataBound
="GridView1_RowDataBound" OnRowCreated ="GridView1_RowCreated" >
</ asp:GridView >
</ form >
</ body >
</ html >

ASP.NET 2.0中合并 GridView 的表頭單元格


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 昭通市| 江源县| 北京市| 田东县| 安岳县| 卢龙县| 奉贤区| 延吉市| 永年县| 红安县| 浏阳市| 盖州市| 新沂市| 福贡县| 胶州市| 锦屏县| 临安市| 绵竹市| 托里县| 平潭县| 神木县| 呼玛县| 九龙坡区| 互助| 仙居县| 太湖县| 肇州县| 通河县| 濉溪县| 乾安县| 定州市| 玛纳斯县| 高阳县| 军事| 永仁县| 竹山县| 泰兴市| 吴桥县| 宣威市| 舒城县| 西畴县|