2014-07-03 22 views

回答

0
<table> 
      <tr> 
       <th>Column1</th> 
       <th>Column2</th> 
      </tr> 
      <tr> 
       <td style="background-color:gray;">Question 1</td> 
       <td>Answer 1</td> 
      </tr> 
      <tr> 
       <td>Question 2</td> 
       <td>Answer 2</td> 
      </tr> 
      <tr style="background-color:yellow;"> 
       <td>Question 3</td> 
       <td>Answer 4</td> 
      </tr> 
     </table> 
0

好吧,如果你想要做动态,那么你可以这样做:

假设在GridView ID = gridview1

Protected Sub GridView_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound 
    If e.Row.RowType = DataControlRowType.DataRow Then 

      Dim question, answer As String 
      question = e.Row.Cells(0).Text 
      answer = e.Row.Cells(1).Text 
      If question = "Will this work or whatever else you wanan check?" 
        e.Row.Cells(0).BackColor = Drawing.Color.Red 
      End If 
'You could then add as many if statements as you need to handle 
'different questions. For answers, you would just change the index to 1. Assuming it's 
'column 1 in your gridview. 

    End If 
End Sub 
相关问题