如何获取repeater某行第一列的值

<div>
    <asp:Repeater ID="Repeater1" runat="server" DataMember="DefaultView"
            DataSourceID="SqlDataSource1">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text=<%# Eval("ProductID")%>></asp:Label>
                <asp:Label ID="Label2" runat="server" Text=<%# Eval("ProductName")%>></asp:Label>
                <br />          

            </ItemTemplate>
    </asp:Repeater>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT [ProductID], [ProductName] FROM [Products]">
        </asp:SqlDataSource>
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
    </div>
 protected void Button1_Click(object sender, EventArgs e)
        {
            Label textControl = (Label)Repeater1.Items[3].FindControl("Label1");
            //textControl.Text 就是你需要的值
        }
foreach (RepeaterItem rs in Repeater1.Items)
        {
            string str = ((Label)rs.FindControl("控件ID")).Text;
        }

如何获取repeater某行第一列的值,布布扣,bubuko.com

时间: 2024-10-14 12:29:48

如何获取repeater某行第一列的值的相关文章

poi获取合并单元格内的第一行第一列的值

当读取如图所示的excel时,显示为第1行 第1列 的内容是:合并单元格 其它在合并单元格区域内的单元格不显示 示例代码如下: 1 import java.io.FileInputStream; 2 import java.io.FileNotFoundException; 3 import java.io.IOException; 4 5 import org.apache.poi.hssf.usermodel.HSSFWorkbook; 6 import org.apache.poi.ss.

DataTable得到某行某列的值

DataTable dt=this.GetRepeatTableData("repeating1"); int count=dt.Rows.Count;for(int x=0;x<count;x++){string Personnes=dt.Rows[x][0].ToString();//第一行第一列 string Passport_No=dt.Rows[x][1].ToString();//第一行第二列 if (Personnes != "") { if (

JavaScript实现获取table中某一列的值

JavaScript实现获取table中某一列的值 1.实现源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> &

JavaScript获取table中某一列的值的方法

1.实现源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C

表格添加一行并在每行第一列大写字母显示jquery实现方法

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title&

在GridView的RowDataBound事件中获取某行某列的值!

protected void gdvOrders_RowDataBound(object sender, GridViewRowEventArgs e)   {               if (e.Row.RowType == DataControlRowType.DataRow)       {           DataRowView drv = (DataRowView)e.Row.DataItem ;           if (drv.Row["Status"].ToS

C# 读取Excel模板 修改某行某列的值 另存为新的Excel

1 protected Application objExcelApp;//定义Excel Application对象 2 private Workbooks objExcelWorkBooks;//定义Workbook工作簿集合对象 3 protected Workbook objExcelWorkbook;//定义Excel workbook工作簿对象 4 private Worksheet objExcelWorkSheet;//定义Workbook工作表对象 5 6 7 8 9 try{

Repeater 根据某一列的值加颜色

//排队中 protected void rptOrdersList_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { if (((OrdersDB)e.Item.DataItem).IsQue

页面加载时通过获取GridView某行某列的值来控制某一列的控件属性

通过获取状态来控制"查看"按钮的Visible属性值. 在前台GridView中添加 OnRowDataBound="GridView1_RowDataBound",如下: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowSorting="True" OnRowDataBoun