Aisha Srivastava

Aisha Srivastava

  • NA
  • 230
  • 28.5k

please check the code for colring alternate rows

Jan 21 2015 6:13 AM
Code for colour alternate rows in table is given below---
pls check it 
I think i am wrong at html lines...




public void colouralternaterow()
        {
            mshtmlTable table1 = null;
            mshtmlTableRow row1 = null;
            mshtmlTableCell cell1 = null;
            GetTableElement(out table1, out row1, out cell1);


            HtmlElement table = getTableHTMLElement();
            if(table!=null)
            {
                HtmlElement selectedrow=table.GetElementsByTagName("tr")[row1.rowIndex];
                selectedrow.Style ="table tr:nth-child(even){background-color: red}";
            }
                else
                {
                    MessageBox.Show("can not do ");
                }




            }