Gridview無資料時顯示表頭的問題

2021-04-13 13:24:49 字數 3139 閱讀 2331

提供了個emptydatatemplate,可以把header的樣式構造到裡面去

<

asp:gridview id="

grdvlist

"runat="

server

"autogeneratecolumns="

false

"cssclass="

datagrid

"width="

720px

"datakeynames="

row_ref_id

"onrowcommand="

grdvlist_rowcommand

"allowpaging="

true

"allowsorting="

true

"pagesize="

5"onpageindexchanging="

grdvlist_pageindexchanging

"onsorting="

grdvlist_sorting

">

<

headerstyle cssclass="

grid_head

"/>

<

rowstyle cssclass="

grid_row

"/>

<

selectedrowstyle cssclass="

grid_row_selected

"/>

<

columns

>

<

asp:boundfield headertext="

action code

"datafield="

action_code

"sortexpression="

action_code

">

<

headerstyle width="

200px

"/>

asp:boundfield

>

<

asp:boundfield headertext="

description

"datafield="

action_description

"sortexpression="

action_description

"/>

<

asp:buttonfield headertext="

detail

"commandname="

detail

"text="

">

<

headerstyle width="

45px

"/>

asp:buttonfield

>

<

asp:buttonfield headertext="

delete

"commandname="

inactive

"text="

">

<

headerstyle width="

45px

"/>

asp:buttonfield

>

<

asp:buttonfield headertext="

active

"commandname="

active

"text="

">

<

headerstyle width="

45px

"/>

asp:buttonfield

>

<

asp:boundfield headertext="

row_ref_id

"datafield="

row_ref_id

"visible="

false

"/>

columns

>

<

emptydatatemplate

>

<

table frame="

void

"cellspacing="

0"cellpadding="

0"border="

1"style="

width:720px;border-collapse:collapse;

">

<

tr class="

grid_head

">

<

th scope="

col"

style="

width:200px;

">

action code

th>

<

th scope="

col"

>

description

th>

<

th scope="

col"

style="

width:45px;

">

detail

th>

<

th scope="

col"

style="

width:45px;

">

delete

th>

tr>

<

tr class="

grid_row

">

<

td colspan="

4"align="

right

">1td

>

tr>

table

>

emptydatatemplate

>

asp:gridview

>

當GridView無資料時顯示表頭

public class ugridview grd.prerender new eventhandler grd prerender void grd prerender object sender,eventargs e private void grd rowdatabound object ...

gridview無資料行時顯示表頭的方法

gridview當資料來源為空時如何實現顯示表頭 問題 asp.net 2.0 中引入的gridview控制項當其資料來源為空時 gridview.datasource null 不能顯示 出表頭.解決 方法一 採用其emptytemplate來實現,模版中寫乙個靜態的table 缺點 麻煩,每個g...

無資料線 debug

當你沒有資料線的時候也想debug,怎麼辦?還有就是測試串列埠的時候,那個插口要被占用,無法跟電腦保持adb連線,怎麼辦?話不多說。官方文件 connect the android powered device via usb to your computer.from your sdkplatfo...