Forum Moderators: open
Each time I create a new row and add it to the table. Also I create about 10 td tags. For each td I assign almost the same text. With the only difference being the datareader getvalue().
I want to create a tablecell array and loop through and populate it.
// CODE: (Shortened)
while(drTemp.Read())
{
intCtr++;
TableRow trTag = new TableRow();
TableCell tdTag0 = new TableCell(), tdTag1 = new TableCell(), tdTag2 = new TableCell() , tdTag3 = new TableCell(), tdTag4 = new TableCell() , tdTag5 = new TableCell(), tdTag6 = new TableCell() , tdTag7 = new TableCell(), tdTag8 = new TableCell() , tdTag9 = new TableCell();// I do the FOLLOWING same code for each td (the GetValue does however change each time):
tdTag0.Text = drTemp.GetValue(0).ToString();
// after this I add all the td's to the tr tag:
trTag.Controls.Add(tdTag0);
// then add to the table:
tblResult.Controls.Add(trTag);
}
// Here is what I am TRYING to do (while reading from the datareader):TableCell[] td = new TableCell[8];
for(int i = 0; i < 8; i++)
{
td[i].Text = "hello";
trTag.Controls.Add(td[i]);
}
// I have an example working:
String[] arr = new String[9];
for(int i = 0; i < 9; i++)
{
arr[i] = "¦ asdlfkj ¦";
Response.Write(arr[i].ToString());
}
>>The reason I want to make an array is to compare all the td's in the tr and then BOLD or something the highest value. Any ideas on this as well?
Any help or hints would be great. Thanks.
(yes I have searched for how to do this let me know if there is a url about this or something)