How to populate two separate repeaters with distinct column name and the value corresponding to the column

后端 未结 2 580
鱼传尺愫
鱼传尺愫 2020-12-22 13:09

How to populate a repeater with two separate list

I have the following repeater:

相关标签:
2条回答
  • 2020-12-22 14:08

    Each row contains individual columns. You can access it through Rows[i].ItemArray

    0 讨论(0)
  • 2020-12-22 14:11

    Your DataTable could to be accessed in the form of array of muti-dimension, besides being the most briefly to access rows and columns. For example:

    myDt.Rows[0][0]; // access the first row and first column
    myDt.Rows[0][1]; // access the first row and second column
    myDt.Rows[0][2]; // access the first row and third column
    myDt.Rows[1][0]; // access the second row and first column
    myDt.Rows[1][1]; // access the second row and second column
    myDt.Rows[1][2]; // access the second row and third column
    

    If you need can go all fields returned using two nested for statement:

    for(int i = 0;i < dtData.Rows.Count;i++)//travels the rows
    {
         for(int j = 0;j < dtData.Rows.Count;j++)//travels the columns
         {
              var valueField = myDt.Rows[i][j];//access the value of current field
         }
    }
    
    0 讨论(0)
提交回复
热议问题