title: Adding color to a table cell using C#
body: <p>I am creating a table and adding cells with contents through c sharp code. My code is as given below:</p>
  
  <pre><code>//creating the table
  Table table1 = new Table();
  table1.ID = "table1";
  table1.BorderStyle = BorderStyle.Dashed;
  table1.GridLines = GridLines.Both;
  this.Controls.Add(table1);
  
  //adding first row
  TableRow row1 = new TableRow();
  
  //adding first cell
  TableCell cell1 = new TableCell();
  
  //adding label
  Label text1 = new Label();
  text1.Text = "Sourav Ganguly";
  
  cell1.Controls.Add(text1);
  row1.Controls.Add(cell1);
  table1.Controls.Add(row1);
  
  //adding second cell
  TableCell cell2 = new TableCell();
  
  //adding label
  Label text2 = new Label();
  text2.Text = "Rahul Dravid";
  
  cell2.Controls.Add(text2);
  row1.Controls.Add(cell2);
  
  //adding third cell
  TableCell cell3 = new TableCell();
  
  //adding label
  Label text3 = new Label();
  text3.Text = "Sachin Tendulkar";
  
  cell3.Controls.Add(text3);
  row1.Controls.Add(cell3);
  
  //adding second row
  TableRow row2=new TableRow();
  
  //adding first cell
  TableCell cell4 = new TableCell();
  
  //adding label
  Label text4 = new Label();
  text4.Text = "Virender Shewag";
  
  cell4.Controls.Add(text4);
  row2.Controls.Add(cell4);
  table1.Controls.Add(row2);
  
  //adding second cell
  TableCell cell5 = new TableCell();
  
  //adding label
  Label text5 = new Label();
  text5.Text = "MS Dhoni";
  
  cell5.Controls.Add(text5);
  row2.Controls.Add(cell5);
  table1.Controls.Add(row2);
  
  //adding third cell
  TableCell cell6 = new TableCell();
  
  //adding label
  Label text6 = new Label();
  text6.Text = "Zaheer Khan";
  
  cell6.Controls.Add(text6);
  row2.Controls.Add(cell6);
  table1.Controls.Add(row2);
  </code></pre>
  
  <p>I wish to add a background color for each cell. Is it possible to create anything like this? i.e in the first cell of the first row, I wish to add red color to only about 50% of the cell. I wish the cell to remain colorless (usual white color) for the remaining 50%. Similarly, for the second cell of the first row, I wish to add yellow color for 80% of the cell and I want the remaining 20% of the cell to be in default white color. Is is possible to achieve such a kind of functionality functionality using C#?</p>