asp.net Repeater取得CheckBox選中的某行某個(gè)值的c#寫(xiě)法
更新時(shí)間:2008年08月06日 13:06:21 作者:
asp.net(c#)利用Repeater取得CheckBox選中行的某個(gè)值的代碼
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.Checked)
{
common.salert(tbx.Text);
}
}
}
關(guān)鍵點(diǎn):在每行再寫(xiě)個(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.Checked)
{
common.salert(tbx.Text);
}
}
}
關(guān)鍵點(diǎn):在每行再寫(xiě)個(gè)隱藏的控件我是用TextBox,代碼如下:
<asp:TextBox id="tbxTableName" runat="server" Text='<%#Eval("TABLE_NAME") %>' style="display:none;" />
相關(guān)文章
silverlight2.0Beta版TextBox輸入中文解決方法
silverlight Beta 2.0 中TetBox輸入漢字,除MS自己的輸入法,其它所有輸入法都會(huì)出現(xiàn)輸入的東西會(huì)在TextBox中重復(fù)一次的現(xiàn)像,google ,Baidu了一下,大家說(shuō)好像是silverlight自己的一個(gè)BUG,可能會(huì)在Repleass的時(shí)候修改。2008-10-10Entity?Framework使用DBContext實(shí)現(xiàn)增刪改查
這篇文章介紹了Entity?Framework使用DBContext實(shí)現(xiàn)增刪改查的方法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-10-10ASP.NET 恢復(fù)備份Sqlserver實(shí)現(xiàn)代碼
在線恢復(fù)和備份SQL Server的代碼,需要的朋友可以參考下。2010-04-04ASP.NET中使用AspnetAccessProvider
ASP.NET中使用AspnetAccessProvider...2007-09-09.NET5修改配置不重啟自動(dòng)生效的實(shí)現(xiàn)
.NET Core,.NET5默認(rèn)配置都是只加載一次,修改配置時(shí)都需要重啟才能生效,如何能修改即時(shí)生效呢,本文就來(lái)介紹一下2021-09-09jenkins部署.net平臺(tái)自動(dòng)化構(gòu)建的方法步驟
這篇文章主要介紹了jenkins部署.net平臺(tái)自動(dòng)化構(gòu)建的方法步驟,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-07-07asp.net DataSet轉(zhuǎn)換成josn并輸出示例
如何將DataSet轉(zhuǎn)換成josn并輸出,這是很多新手朋友們遇到的問(wèn)題,下面有個(gè)不錯(cuò)的示例,希望對(duì)大家有所幫助2014-01-01asp.net access web.config denied
如果出現(xiàn)這個(gè)問(wèn)題,最好首先檢查一下ASPNET的帳號(hào),是否有訪問(wèn)權(quán)限。2009-04-04