| 導購 | 订阅 | 在线投稿
分享
 
 
 

使用ComponentOne C1WebGrid控件

來源:互聯網網民  2006-09-16 05:50:24  評論

作者:Sinory

ComponentOne.Studio.Enterprise.2006中的(C1StudioAspNET2_T106)是著名的C1開發的針對ASP.NET2.0的一套控件庫.爲ASP.NET開發人員提供了功能豐富的Web開發組件。包括個表格,報表,圖表,數據,用戶界面和電子商務組件等支持.C1WebGrid是其中最基本的控件之一.

下面介紹它的具體應用方法:

添加引用:

使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
<%
使用ComponentOne C1WebGrid控件
@ Register Assembly="C1.Web.C1WebGrid.2" Namespace="C1.Web.C1WebGrid" TagPrefix="C1WebGrid" %>
使用ComponentOne C1WebGrid控件

在網頁中添加定義

使用ComponentOne C1WebGrid控件
<c1webgrid:c1webgrid id="C1WGridResult" width="100%" runat="server" allowpaging="True" allowsorting="True" backcolor="White" bordercolor="#999999" borderstyle="Groove" borderwidth="1px" cellpadding="3" groupindent="" pagesize="30" allowcolsizing="True" imagesortascending="~/images/up.gif" imagesortdescending="~/images/down.gif" onpageindexchanging="C1WGridResult_PageIndexChanged" onsortingcommand="C1WGridResult_SortingCommand" onitemdatabound="C1WGridResult_ItemDataBound" onitemcreated="C1WGridResult_ItemCreated">
使用ComponentOne C1WebGrid控件
<footerstyle backcolor="#CCCCCC" font-size="9pt" font-bold="False" font-italic="False" font-overline="False"
使用ComponentOne C1WebGrid控件
font-strikeout="False" font-underline="False" forecolor="Black" />
使用ComponentOne C1WebGrid控件
<selecteditemstyle backcolor="White" font-bold="False" font-italic="False" font-overline="False"
使用ComponentOne C1WebGrid控件
font-strikeout="False" font-underline="False" forecolor="White" />
使用ComponentOne C1WebGrid控件
<itemstyle backcolor="WhiteSmoke" font-size="9pt" font-bold="False" font-italic="False" font-overline="False"
使用ComponentOne C1WebGrid控件
font-strikeout="False" font-underline="False" forecolor="Black" horizontalalign="Left" bordercolor="#E0E0E0" borderstyle="Dashed" borderwidth="1px" wrap="False" />
使用ComponentOne C1WebGrid控件
<groupingstyle backcolor="White" bordercolor="Silver" borderwidth="1px" wrap="False"></groupingstyle>
使用ComponentOne C1WebGrid控件
<pagerstyle backcolor="#DEDBDE" font-bold="False" font-italic="False" font-overline="False"
使用ComponentOne C1WebGrid控件
font-strikeout="False" font-underline="False" forecolor="Black" horizontalalign="Left" mode="NumericPages" borderstyle="Groove" borderwidth="1px" />
使用ComponentOne C1WebGrid控件
<headerstyle backcolor="#999999" font-size="9pt" height="25px" font-bold="True" font-italic="False" font-overline="False"
使用ComponentOne C1WebGrid控件
font-strikeout="False" font-underline="False" forecolor="Black" cssclass="C1WGridCss" wrap="False" />
使用ComponentOne C1WebGrid控件
<alternatingitemstyle backcolor="LightGray" font-bold="False" font-italic="False" font-overline="False"
使用ComponentOne C1WebGrid控件
font-strikeout="False" font-underline="False" bordercolor="#404040" borderstyle="Dotted" borderwidth="1px" />
使用ComponentOne C1WebGrid控件

使用ComponentOne C1WebGrid控件
</c1webgrid:c1webgrid>

下面介紹幾個基本的屬性:

allowpaging="True" ——是否允許分頁

allowsorting="True"——是否允許排序

pagesize="30" ——頁面包含的記錄的條數

allowcolsizing="True"——是否允許通過拖動改變列寬

imagesortascending="~/images/arrow_up.gif",imagesortdescending="~/images/arrow_down.gif" ——指定排序時在列首顯示的圖片

onpageindexchanging="C1WGridResult_PageIndexChanged" ——關聯到分頁處理函數onsortingcommand="C1WGridResult_SortingCommand" ——關聯到排序函數

onitemdatabound="C1WGridResult_ItemDataBound" ——關聯到數據綁定處理函數

onitemcreated="C1WGridResult_ItemCreated"——在每個Item創建後觸發

onsortingcommand——處理排序示例

//注意在設置WebGrid列時要指定每個列自己的SortExpression值,這個函數才能生效,該值一般爲該列綁定到的列的列名。

使用ComponentOne C1WebGrid控件
protected void C1WGridResult_SortingCommand(object sender, C1.Web.C1WebGrid.C1SortingCommandEventArgs e)
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
//用來記錄排序方式
使用ComponentOne C1WebGrid控件
String SortDirection = "ASC";
使用ComponentOne C1WebGrid控件
//用來記錄排序表達式
使用ComponentOne C1WebGrid控件
String SortExpression = e.SortExpression.ToString();//得到當前選擇排序的列的排序表達式
使用ComponentOne C1WebGrid控件
//如果爲空則直接返回
使用ComponentOne C1WebGrid控件
if (SortExpression == "") return;
使用ComponentOne C1WebGrid控件
try
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
//如果不爲null
使用ComponentOne C1WebGrid控件
if (C1WGridResult.Attributes["SortExpression"] != null)
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
if (SortExpression == C1WGridResult.Attributes["SortExpression"].ToString())
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
SortDirection = (C1WGridResult.Attributes["SortDirection"].ToString() == SortDirection ? "DESC" : "ASC");//選擇相反的排序方式
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件
else
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
SortDirection = "DESC";//
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件
//將上面得到的值附給WebGrid,然後重新綁定數據
使用ComponentOne C1WebGrid控件
C1WGridResult.Attributes["SortExpression"] = SortExpression;
使用ComponentOne C1WebGrid控件
C1WGridResult.Attributes["SortDirection"] = SortDirection;
使用ComponentOne C1WebGrid控件
BindC1WGridResult();
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件
catch (Exception ex)
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件

使用ComponentOne C1WebGrid控件
//這裏代碼的目的是爲了使不能排序的列,如模板列,的列
使用ComponentOne C1WebGrid控件
//頭顯示爲文字形式而不是連接形式,因爲在這個控件中,
使用ComponentOne C1WebGrid控件
//即使把列的SortExpression設置爲空也還是會在列頭處
使用ComponentOne C1WebGrid控件
//顯示爲一個linkbutton(和GridView不同)
使用ComponentOne C1WebGrid控件
protected void C1WGridResult_ItemCreated(object sender, C1.Web.C1WebGrid.C1ItemEventArgs e)
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
try
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
if (e.Item.ItemType == C1.Web.C1WebGrid.C1ListItemType.Header)
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
{
使用ComponentOne C1WebGrid控件
TableCellCollection tcc = e.Item.Cells;
使用ComponentOne C1WebGrid控件
//這裏假設第一列爲模板列
使用ComponentOne C1WebGrid控件
tcc.RemoveAt(0);
使用ComponentOne C1WebGrid控件
tcc.Add(new TableHeaderCell());
使用ComponentOne C1WebGrid控件
tcc[0].Text = "選擇";//設置列頭文字
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件
使用ComponentOne C1WebGrid控件
catch
使用ComponentOne C1WebGrid控件
{ }
使用ComponentOne C1WebGrid控件
}
使用ComponentOne C1WebGrid控件

另外還可以通如下設置使相同內容的兩個Cell合並

C1WGridResult.Columns[2].RowMerge = C1.Web.C1WebGrid.RowMergeEnum.Free;//合並相同

 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
作者:Sinory ComponentOne.Studio.Enterprise.2006中的(C1StudioAspNET2_T106)是著名的C1開發的針對ASP.NET2.0的一套控件庫.爲ASP.NET開發人員提供了功能豐富的Web開發組件。包括個表格,報表,圖表,數據,用戶界面和電子商務組件等支持.C1WebGrid是其中最基本的控件之一. 下面介紹它的具體應用方法: 添加引用: [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif[/img][/url]<%[url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]@ Register Assembly="C1.Web.C1WebGrid.2" Namespace="C1.Web.C1WebGrid" TagPrefix="C1WebGrid" %> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] 在網頁中添加定義 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] <c1webgrid:c1webgrid id="C1WGridResult" width="100%" runat="server" allowpaging="True" allowsorting="True" backcolor="White" bordercolor="#999999" borderstyle="Groove" borderwidth="1px" cellpadding="3" groupindent="" pagesize="30" allowcolsizing="True" imagesortascending="~/images/up.gif" imagesortdescending="~/images/down.gif" onpageindexchanging="C1WGridResult_PageIndexChanged" onsortingcommand="C1WGridResult_SortingCommand" onitemdatabound="C1WGridResult_ItemDataBound" onitemcreated="C1WGridResult_ItemCreated"> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] <footerstyle backcolor="#CCCCCC" font-size="9pt" font-bold="False" font-italic="False" font-overline="False" [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] font-strikeout="False" font-underline="False" forecolor="Black" /> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] <selecteditemstyle backcolor="White" font-bold="False" font-italic="False" font-overline="False" [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] font-strikeout="False" font-underline="False" forecolor="White" /> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] <itemstyle backcolor="WhiteSmoke" font-size="9pt" font-bold="False" font-italic="False" font-overline="False" [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] font-strikeout="False" font-underline="False" forecolor="Black" horizontalalign="Left" bordercolor="#E0E0E0" borderstyle="Dashed" borderwidth="1px" wrap="False" /> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] <groupingstyle backcolor="White" bordercolor="Silver" borderwidth="1px" wrap="False"></groupingstyle> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] <pagerstyle backcolor="#DEDBDE" font-bold="False" font-italic="False" font-overline="False" [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] font-strikeout="False" font-underline="False" forecolor="Black" horizontalalign="Left" mode="NumericPages" borderstyle="Groove" borderwidth="1px" /> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] <headerstyle backcolor="#999999" font-size="9pt" height="25px" font-bold="True" font-italic="False" font-overline="False" [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] font-strikeout="False" font-underline="False" forecolor="Black" cssclass="C1WGridCss" wrap="False" /> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] <alternatingitemstyle backcolor="LightGray" font-bold="False" font-italic="False" font-overline="False" [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] font-strikeout="False" font-underline="False" bordercolor="#404040" borderstyle="Dotted" borderwidth="1px" /> [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] </c1webgrid:c1webgrid> 下面介紹幾個基本的屬性: allowpaging="True" ——是否允許分頁 allowsorting="True"——是否允許排序 pagesize="30" ——頁面包含的記錄的條數 allowcolsizing="True"——是否允許通過拖動改變列寬 imagesortascending="~/images/arrow_up.gif",imagesortdescending="~/images/arrow_down.gif" ——指定排序時在列首顯示的圖片 onpageindexchanging="C1WGridResult_PageIndexChanged" ——關聯到分頁處理函數onsortingcommand="C1WGridResult_SortingCommand" ——關聯到排序函數 onitemdatabound="C1WGridResult_ItemDataBound" ——關聯到數據綁定處理函數 onitemcreated="C1WGridResult_ItemCreated"——在每個Item創建後觸發 onsortingcommand——處理排序示例 //注意在設置WebGrid列時要指定每個列自己的SortExpression值,這個函數才能生效,該值一般爲該列綁定到的列的列名。 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url]protected void C1WGridResult_SortingCommand(object sender, C1.Web.C1WebGrid.C1SortingCommandEventArgs e) [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] //用來記錄排序方式 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] String SortDirection = "ASC"; [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] //用來記錄排序表達式 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] String SortExpression = e.SortExpression.ToString();//得到當前選擇排序的列的排序表達式 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] //如果爲空則直接返回 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] if (SortExpression == "") return; [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] try [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] //如果不爲null [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] if (C1WGridResult.Attributes["SortExpression"] != null) [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] if (SortExpression == C1WGridResult.Attributes["SortExpression"].ToString()) [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] SortDirection = (C1WGridResult.Attributes["SortDirection"].ToString() == SortDirection ? "DESC" : "ASC");//選擇相反的排序方式 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] else [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] SortDirection = "DESC";// [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] //將上面得到的值附給WebGrid,然後重新綁定數據 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] C1WGridResult.Attributes["SortExpression"] = SortExpression; [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] C1WGridResult.Attributes["SortDirection"] = SortDirection; [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] BindC1WGridResult(); [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] catch (Exception ex) [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url]//這裏代碼的目的是爲了使不能排序的列,如模板列,的列 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url]//頭顯示爲文字形式而不是連接形式,因爲在這個控件中, [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url]//即使把列的SortExpression設置爲空也還是會在列頭處 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url]//顯示爲一個linkbutton(和GridView不同) [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url]protected void C1WGridResult_ItemCreated(object sender, C1.Web.C1WebGrid.C1ItemEventArgs e) [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] try [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] if (e.Item.ItemType == C1.Web.C1WebGrid.C1ListItemType.Header) [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif[/img][/url] [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] TableCellCollection tcc = e.Item.Cells; [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] //這裏假設第一列爲模板列 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] tcc.RemoveAt(0); [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] tcc.Add(new TableHeaderCell()); [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img][/url] tcc[0].Text = "選擇";//設置列頭文字 [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img][/url][url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif[/img][/url] catch [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/dot.gif[/img][/url]{ } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif[/img][/url] } [url=/bbs/detail_501487.html][img]http://www.cnblogs.com/Images/OutliningIndicators/None.gif[/img][/url] 另外還可以通如下設置使相同內容的兩個Cell合並 C1WGridResult.Columns[2].RowMerge = C1.Web.C1WebGrid.RowMergeEnum.Free;//合並相同
󰈣󰈤
王朝萬家燈火計劃
期待原創作者加盟
 
 
 
>>返回首頁<<
 
 
 
 
 
 熱帖排行
 
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有