日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

GridView自動(dòng)增加序號(hào)(三種實(shí)現(xiàn)方式)_.Net教程

編輯Tag賺U幣

推薦:關(guān)于WPF使用MultiConverter控制Button狀態(tài)的詳細(xì)介紹
本篇文章小編將為大家介紹,關(guān)于WPF使用MultiConverter控制Button狀態(tài)的詳細(xì)介紹。需要的朋友參考下

第一種方式,直接在Aspx頁(yè)面GridView模板列中.這種的缺點(diǎn)是到第二頁(yè)分頁(yè)時(shí)又重新開(kāi)始了.
復(fù)制代碼 代碼如下:www.hl5o.cn

<asp:TemplateField HeaderText="序號(hào)" InsertVisible="False">
<ItemTemplate>
<%#Container.DataItemIndex+1%>
</ItemTemplate>
</asp:TemplateField>

第二種方式分頁(yè)時(shí)進(jìn)行了計(jì)算,這樣會(huì)累計(jì)向下加.
復(fù)制代碼 代碼如下:www.hl5o.cn

<asp:TemplateField HeaderText="序號(hào)" InsertVisible="False">
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center"/>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# this.GridView1.PageIndex * this.GridView1.PageSize + this.GridView1.Rows.Count + 1%>' />
</ItemTemplate>
</asp:TemplateField>

還有一種方式放在cs代碼中,和第二種相似.
復(fù)制代碼 代碼如下:www.hl5o.cn

<asp:BoundField HeaderText="序號(hào)" ></asp:BoundField>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex != -1)
{
int indexID = this.GridView1.PageIndex * this.myGridView.PageSize + e.Row.RowIndex + 1;
e.Row.Cells[0].Text = indexID.ToString();
}
}

分享:基于自定義Unity生存期模型PerCallContextLifeTimeManager的問(wèn)題
本篇文章小編將為大家介紹,基于自定義Unity生存期模型PerCallContextLifeTimeManager的問(wèn)題。需要的朋友參考下

來(lái)源:模板無(wú)憂//所屬分類:.Net教程/更新時(shí)間:2013-04-22
相關(guān).Net教程