asp.net Repeater取得CheckBox选中的某行某个值的c#写法

所属分类: 网络编程 / ASP.NET 阅读数: 1903
收藏 0 赞 0 分享
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);
            }

    }
}
关键点:在每行再写个隐藏的控件我是用TextBox,代码如下:
<asp:TextBox id="tbxTableName" runat="server" Text='<%#Eval("TABLE_NAME") %>' style="display:none;" />
更多精彩内容其他人还在看

Asp.net中的mail的发送

Asp.net中的mail的发送
收藏 0 赞 0 分享

用ASP.Net实现文件的在线压缩和解压缩

用ASP.Net实现文件的在线压缩和解压缩
收藏 0 赞 0 分享

ASP.NET中文件上传下载方法集合

ASP.NET中文件上传下载方法集合
收藏 0 赞 0 分享

ASP.NET通过Remoting service上传文件

ASP.NET通过Remoting service上传文件
收藏 0 赞 0 分享

ASP.NET2.0服务器控件之Render方法

ASP.NET2.0服务器控件之Render方法
收藏 0 赞 0 分享

ASP.NET2.0 WebRource,开发微调按钮控件

ASP.NET2.0 WebRource,开发微调按钮控件
收藏 0 赞 0 分享

ASP.NET2.0新特性概述

ASP.NET2.0新特性概述
收藏 0 赞 0 分享

介绍几个ASP.NET中容易忽略但却很重要的方法函数

介绍几个ASP.NET中容易忽略但却很重要的方法函数
收藏 0 赞 0 分享

asp.net2.0如何加密数据库联接字符串

asp.net2.0如何加密数据库联接字符串
收藏 0 赞 0 分享

用.NET 2.0压缩/解压功能处理大型数据

用.NET 2.0压缩/解压功能处理大型数据
收藏 0 赞 0 分享
查看更多