asp.net獲取ListView與gridview中當(dāng)前行的行號
本文實(shí)例講述了asp.net獲取ListView與gridview中當(dāng)前行的行號。分享給大家供大家參考,具體如下:
aspx中,在gridview/ListView中,有一模板列,就叫l(wèi)inkbutton,想單擊它時,獲取它所在行的索引值
ListView中:
第一種:
<ItemTemplate> <tr> <td> <asp:LinkButton runat="server" ID="btnSelected" Text='<%# (Container.DisplayIndex+1).ToString() %>' ></asp:LinkButton> </td> </tr> </ItemTemplate>
第二種:
<ItemTemplate> <li> <asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete" Text="<%# Container.DataItem %>"></asp:LinkButton> </li> </ItemTemplate>
gridview中
第一種:
<itemtemplate> <asp:LinkButton ID="LinkButton1" runat="server" </itemtemplate>
protected void LinkButton1_Click(object sender, EventArgs e)
{
//行號
int row = ((GridViewRow)((LinkButton)sender).NamingContainer).RowIndex;
}
第二種:
<asp:GridView ID="gvTest" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> DisplayIndex : <%# Container.DisplayIndex %> || DataItemIndex : <%# Container.DataItemIndex %><br /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView>
希望本文所述對大家asp.net程序設(shè)計有所幫助。
- Android 中ScrollView嵌套GridView,ListView的實(shí)例
- 關(guān)于Android中ListView嵌套GridView的問題
- Android之ScrollView嵌套ListView和GridView沖突的解決方法
- ListView嵌套GridView使用詳解及注意事項(xiàng)
- 淺談RecyclerView(完美替代ListView,GridView)
- Android開發(fā)之ListView、GridView 詳解及示例代碼
- Android RecyclerView詳解之實(shí)現(xiàn) ListView GridView瀑布流效果
- 解決EditText、ListView以及GridView同時使用,輸入法自動跳出來的方法
- android ListView和GridView拖拽移位實(shí)現(xiàn)代碼
- Android仿貼吧內(nèi)容下的簡單ListView嵌套GridView
相關(guān)文章
擴(kuò)展 Entity Framework支持復(fù)雜的過濾條件(多個關(guān)鍵字模糊匹配)
之前遇到一個棘手的Linq to EF查詢的技術(shù)問題,現(xiàn)有產(chǎn)品表Product,需要根據(jù)多個關(guān)鍵字模糊匹配產(chǎn)品名稱, 現(xiàn)將解決方案分享出來,按興趣的朋友可以參考下2012-12-12
asp.net實(shí)現(xiàn)三層架構(gòu)的例子
這篇文章主要介紹了asp.net實(shí)現(xiàn)三層架構(gòu)的例子,十分的簡單實(shí)用,有需要的小伙伴可以參考下。2015-07-07
asp.net slickupload 使用方法(文件上傳)
asp.net下使用slickupload上傳文件的代碼2009-05-05
客戶端用JavaScript填充DropDownList控件 服務(wù)器端讀不到值
今天遇到一個奇怪的問題,某一頁面需要使用三級級聯(lián)下拉列表框。為提高用戶體驗(yàn),采用jQuery的cascadingDropDown插件調(diào)用后臺Web Services來實(shí)現(xiàn)ajax填充。2010-09-09
在 ASP.Net Core 中使用 MiniProfiler的方法
這篇文章主要介紹了在 ASP.Net Core 中使用 MiniProfiler的方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-03-03
ASP.NET用戶注冊實(shí)戰(zhàn)(第11節(jié))
這篇文章主要介紹了ASP.NET用戶注冊實(shí)戰(zhàn),鞏固前10小節(jié)所學(xué)的全部知識,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2015-08-08
.Net core下直接執(zhí)行SQL語句并生成DataTable的實(shí)現(xiàn)方法
.net core可以執(zhí)行SQL語句,但是只能生成強(qiáng)類型的返回結(jié)果。這篇文章主要介紹了.Net core下直接執(zhí)行SQL語句并生成DataTable的相關(guān)資料,需要的朋友可以參考下2016-11-11
ASP.NET使用HttpWebRequest讀取遠(yuǎn)程網(wǎng)頁源代碼
本文分享了一個使用HttpWebRequest讀取遠(yuǎn)程網(wǎng)頁的案例,供大家參考學(xué)習(xí)。2016-03-03
.Net Core+Angular Cli/Angular4開發(fā)環(huán)境搭建教程
這篇文章主要為大家詳細(xì)介紹了.Net Core+Angular Cli/Angular4開發(fā)環(huán)境搭建教程,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-06-06

