trouble in creating html table through c sharp
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: trouble in creating html table through c sharp

  1. #1
    Join Date
    Jul 2011

    Unhappy trouble in creating html table through c sharp

    Hi guys,

    I am trying to create a html table through c sharp. I opened a new web application and typed the following in default.aspx.cs file

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Drawing;
    using System.Drawing.Design;
    using System.Drawing.Drawing2D;
    using System.Drawing.Imaging;
    using System.Drawing.Printing;
    using System.Drawing.Text;

    namespace TablePOC
    public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
    Table tbl = new Table();
    tbl.ID = "table1";
    tbl.BorderStyle = BorderStyle.Dotted;
    tbl.GridLines = GridLines.Both;

    TableRow rw1 = new TableRow();
    TableCell cell1 = new TableCell();
    cell1.Width = 450;

    Label text1 = new Label();
    text1.Text = "there are large number of people who were trapped in the avalanche ";

    TableRow rw2 = new TableRow();
    TableCell cell2 = new TableCell();
    cell2.Width = 450;
    Label text2 = new Label();
    text2.Text = "the blue wild fox jumped over the fence and ran away never to return again ";


    my requirement is that I want each cell of the table to have 3 different colors. I have added 2 cells in 2 rows in d above code. Its easy to add 1 color as background color for a cell. But, I want to add 3 colors as background color for the cell such that, if the cell is say 100px width, the first 30px of the cell should be green, the second 30px should be yellow and the last 40px should be pink. Can anybody help me in dis ? Thanks in advance

  2. #2
    Join Date
    May 2011
    Washington State

    Re: trouble in creating html table through c sharp

    I know this probably isn't much help, but since nobody has replied... I'm thinking there just is no table cell parameter that is going to provide for a multi-colored background display... I think you are going to need some CSS magic to create some sort of display element you can add to the cell that looks how you want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)