當GridView無資料時顯示表頭

2021-04-13 02:11:22 字數 1389 閱讀 3138

public class ugridview

grd.prerender += new eventhandler(grd_prerender);

}void grd_prerender(object sender, eventargs e)

private void grd_rowdatabound(object sender, gridviewroweventargs e)

}private void drawheader(object sender)

}gridviewrow row = new gridviewrow(-1, -1, datacontrolrowtype.emptydatarow, datacontrolrowstate.normal);

foreach (datacontrolfield field in grd.columns)

tableitemstyle headstyle = grd.headerstyle;

tableitemstyle emptystyle = grd.emptydatarowstyle;

emptystyle.width = headstyle.width;

emptystyle.height = headstyle.height;

emptystyle.forecolor = headstyle.forecolor;

emptystyle.font.size = headstyle.font.size;

emptystyle.font.bold = headstyle.font.bold;

emptystyle.font.name = headstyle.font.name;

emptystyle.font.strikeout = headstyle.font.strikeout;

emptystyle.font.underline = headstyle.font.underline;

emptystyle.backcolor = headstyle.backcolor;

emptystyle.verticalalign = headstyle.verticalalign;

emptystyle.horizontalalign = headstyle.horizontalalign;

emptystyle.cssclass = headstyle.cssclass;

emptystyle.bordercolor = headstyle.bordercolor;

emptystyle.borderstyle = headstyle.borderstyle;

emptystyle.borderwidth = headstyle.borderwidth;

if (grd.controls.count == 0)

else

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

提供了個emptydatatemplate,可以把header的樣式構造到裡面去 asp gridview id grdvlist runat server autogeneratecolumns false cssclass datagrid width 720px datakeynames ro...

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...