Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Put the logic to find matches into the data table building logic that you posted, like this:</p> <pre><code>// This loop is getting rows from table Customer and adding them as Rows of dt. for (int x = 0; x &lt; (lengthofCustomer); x++) { // Build the pieces of data for your row here // Name // Loop through each city for (int y = 0; y &lt; (lengthofAddress); y++) { // Determine if each city is a match or not, // if so then put "X" in that row's cell here } } </code></pre> <p>Now when you bind your grid with the data table, you will not need to handle the <code>RowDataBound</code> event, because the <code>X</code> will be in the right cell(s) already.</p> <hr> <p>UPDATE:</p> <p>To put values into a new data table row, you need to create a new row and then apply the cell values via the index of the row, like this:</p> <pre><code>DataRow row; // Create new DataRow objects and add to DataTable. for(int i = 0; i &lt; 10; i++) { row = YourDataTable.NewRow(); row["Name"] = theName; // Loop through each city for (int y = 0; y &lt; (lengthofAddress); y++) { // Determine if each city is a match or not, // if so then put "X" in that row's cell here if(match) { row[y+1] = "X"; } } YourDataTable.Rows.Add(row); } </code></pre> <p>UPDATE 2:</p> <p>If the rows for each person in the match column already exist, then loop through each row like this:</p> <pre><code>foreach(DataRow row in TheTable.Rows) { // Loop through each city for (int y = 0; y &lt; (lengthofAddress); y++) { // Determine if each city is a match or not, // if so then put "X" in that row's cell here if(match) { row[y+1] = "X"; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload