asp.net Repeater取得CheckBox選中的某行某個(gè)值
更新時(shí)間:2008年07月30日 09:07:55 作者:
Repeater取得CheckBox選中的某行某個(gè)值的實(shí)現(xiàn)代碼
1、
foreach (Control c in this.rptTables.Controls)
{
CheckBox cbx = (CheckBox)c.FindControl("cbxId");
TextBox tbx = (TextBox)c.FindControl("tbxTableName");
if (cbx != null)
{
if (cbx.Checked == true)
{
common.salert(tbx.Text);
}
}
}
2、
for (int i = 0; i < this.rptTables.Items.Count; i++)
{
CheckBox cbx = (CheckBox)rptTables.Items[i].FindControl("cbxId");
TextBox tbx = (TextBox)rptTables.Items[i].FindControl("tbxTableName");
if (cbx != null)
{
if (cbx != null)
{
if (cbx.Checked)
{
common.salert(tbx.Text);
}
}
}
}
關(guān)鍵點(diǎn):在每行再寫個(gè)隱藏的控件我是用TextBox,代碼如下:
<asp:TextBox id="tbxTableName" runat="server" Text='<%#Eval("TABLE_NAME") %>' style="display:none;" />
foreach (Control c in this.rptTables.Controls)
{
CheckBox cbx = (CheckBox)c.FindControl("cbxId");
TextBox tbx = (TextBox)c.FindControl("tbxTableName");
if (cbx != null)
{
if (cbx.Checked == true)
{
common.salert(tbx.Text);
}
}
}
2、
for (int i = 0; i < this.rptTables.Items.Count; i++)
{
CheckBox cbx = (CheckBox)rptTables.Items[i].FindControl("cbxId");
TextBox tbx = (TextBox)rptTables.Items[i].FindControl("tbxTableName");
if (cbx != null)
{
if (cbx != null)
{
if (cbx.Checked)
{
common.salert(tbx.Text);
}
}
}
}
關(guān)鍵點(diǎn):在每行再寫個(gè)隱藏的控件我是用TextBox,代碼如下:
<asp:TextBox id="tbxTableName" runat="server" Text='<%#Eval("TABLE_NAME") %>' style="display:none;" />
相關(guān)文章
asp.net下降文本格式數(shù)據(jù)導(dǎo)入到數(shù)據(jù)庫中的代碼
導(dǎo)入文本格式數(shù)據(jù)到數(shù)據(jù)庫中的代碼,需要的朋友可以參考下。2010-05-05
asp.net實(shí)現(xiàn)生成縮略圖及給原始圖加水印的方法示例
這篇文章主要介紹了asp.net實(shí)現(xiàn)生成縮略圖及給原始圖加水印的方法,結(jié)合具體實(shí)例形式分析了asp.net圖片的縮略圖與水印操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2017-10-10
詳解ASP.NET Core MVC 源碼學(xué)習(xí):Routing 路由
本篇文章主要介紹了詳解ASP.NET Core MVC 源碼學(xué)習(xí):Routing 路由 ,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。2017-03-03
ASP.NET記錄錯(cuò)誤日志的實(shí)現(xiàn)方法
在本文中,我們將通過一個(gè)簡單的處理來記錄在我們的網(wǎng)站中的錯(cuò)誤和異常2013-05-05
ASP.NET Core對Controller進(jìn)行單元測試的完整步驟
這篇文章主要給大家介紹了關(guān)于ASP.NET Core對Controller進(jìn)行單元測試的完整步驟,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用ASP.NET Core具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2020-06-06
asp.net在后端動(dòng)態(tài)添加樣式表調(diào)用的方法
這篇文章主要介紹了asp.net在后端動(dòng)態(tài)添加樣式表調(diào)用的方法,涉及asp.net操作樣式表的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-04-04

