濮阳杆衣贸易有限公司

主頁 > 知識庫 > asp.net獲取ListView與gridview中當(dāng)前行的行號

asp.net獲取ListView與gridview中當(dāng)前行的行號

熱門標(biāo)簽:濮陽外呼電銷系統(tǒng)怎么樣 地圖標(biāo)注的公司有哪些 400電話辦理哪家性價比高 天心智能電銷機器人 遂寧市地圖標(biāo)注app 代理接電話機器人如何取消 塔城代理外呼系統(tǒng) 地圖定位圖標(biāo)標(biāo)注 地圖標(biāo)注專業(yè)團(tuán)隊

本文實例講述了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的實例
  • 關(guān)于Android中ListView嵌套GridView的問題
  • Android之ScrollView嵌套ListView和GridView沖突的解決方法
  • ListView嵌套GridView使用詳解及注意事項
  • 淺談RecyclerView(完美替代ListView,GridView)
  • Android開發(fā)之ListView、GridView 詳解及示例代碼
  • Android RecyclerView詳解之實現(xiàn) ListView GridView瀑布流效果
  • 解決EditText、ListView以及GridView同時使用,輸入法自動跳出來的方法
  • android ListView和GridView拖拽移位實現(xiàn)代碼
  • Android仿貼吧內(nèi)容下的簡單ListView嵌套GridView

標(biāo)簽:吉林 宜春 河南 汕頭 麗江 本溪 重慶 婁底

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp.net獲取ListView與gridview中當(dāng)前行的行號》,本文關(guān)鍵詞  asp.net,獲取,ListView,與,gridview,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp.net獲取ListView與gridview中當(dāng)前行的行號》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp.net獲取ListView與gridview中當(dāng)前行的行號的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    老河口市| 潮安县| 宜黄县| 安龙县| 理塘县| 洛浦县| 临沧市| 灵川县| 福鼎市| 大石桥市| 琼中| 武平县| 板桥市| 乐至县| 读书| 兰西县| 涿州市| 陆河县| 白山市| 名山县| 犍为县| 马龙县| 呼图壁县| 教育| 云霄县| 峡江县| 略阳县| 筠连县| 富源县| 夏邑县| 遂昌县| 葫芦岛市| 若羌县| 丽水市| 道真| 宜城市| 凤城市| 巩留县| 昔阳县| 屏山县| 贞丰县|