How to clear css cell and rowspan style in c #

Below is the html table. In the first table, the first tr first cell I gave csstdgreen to td. and the second cell has csstdgreen with rowspan 3. I need to clear csstdgreen and rowspan and how to convert the second table tr. I have a loop through a table and the control cell has csstdgreen and how many rowspan. if the cell has csstdgreen and rowspan then make the first table like the second table. How do I check css and rowspan on the C # side. I am looking for google but not getting it.

//First Table <table id="mytable" runat="server"> <tr class="csstablelisttd"> <td>09:00AM</td> <td class="csstdgreen">00</td> <td class="csstdgreen" rowspan="3">John</td> </tr> <tr class="csstablelisttd"> <td></td> <td class="csstdgreen">15 </td> </tr> <tr class="csstablelisttd"> <td></td> <td class="csstdgreen">15 </td> </tr> </table> //Second Table <table id="mytable" runat="server"> <tr class="csstablelisttd"> <td>09:00AM</td> <td>00</td> <td>John</td> </tr> <tr class="csstablelisttd"> <td></td> <td>15 </td> <td></td> </tr> <tr class="csstablelisttd"> <td></td> <td class="csstdgreen">15 </td> <td></td> </tr> </table> 

// I go through a table like this to the server code.

  for(int i = 0; i <= mytable.Rows.Count - 1; i++) { for(int j = 0; j <= mytable.Rows.Count - 1; j++) { //error in if conditon object refrence not set to an instance of an object if(mytable.Rows[i].Cells[j].Attributes["csstdgreen"].Equals("csstdgreen")) { } } } 
+4
source share
1 answer

remove csscalss

 if(Cell1.Attributes["Class"].Equals("csstdgreen")) Cell1.Attributes.Remove("Class"); 

Add CssClass

 Cell1.Attributes.Add("Class","MyClass"); 
+2
source

All Articles