<asp:table> problems

Discussion in 'ASP .Net' started by Dave Bennett, Jul 15, 2004.

  1. Dave Bennett

    Dave Bennett Guest

    I am hoping someone can help me because I am really beginning to hate IE.

    I am using the following code to generate a dynamic table.
    private void buildTable(ArrayList Products)
    {
    //Variables
    int cnt = Products.Count;
    string key = "";
    Control c;
    TableRow r = new TableRow();
    TableCell Xcell = new TableCell();

    //Add Empty cell
    Xcell.Width=Unit.Parse("100");
    r.Cells.Add(Xcell);

    //Build Product Titles
    for (int i=0;i<cnt;i++)
    {
    TableCell cell = new TableCell();
    cell.CssClass="whiteSub";
    cell.Width=Unit.Pixel(125);
    Label lbl = new Label();
    lbl.ID = "Prod" + (i+1) + "_Nm";
    cell.Controls.Add(lbl);
    r.Cells.Add(cell);
    }
    ProdName.Rows.Add(r);
    }

    When I render in IE it puts the width inside a style tag which I do not
    want. See below for example of rendered HTML.

    <table id="ProdName" cellspacing="2" cellpadding="2" border="0">
    <tr>
    <td style="width:100px;"></td>
    <td class="whiteSub" style="width:125px;"><span
    id="Prod1_Nm">xxxx</span></td>
    <td class="whiteSub" style="width:125px;"><span
    id="Prod2_Nm">xxxx</span></td>
    <td class="whiteSub" style="width:125px;"><span
    id="Prod3_Nm">xxxx</span></td>
    </tr>
    </table>


    In Mozilla Firefox it renders it correctly. See below for example of
    rendered HTML

    <table id="ProdName" cellspacing="2" cellpadding="2" border="0">
    <tr>
    <td width="100"></td>
    <td class="whiteSub" width="125"><span id="Prod1_Nm">xxxx</span></td>
    <td class="whiteSub" width="125"><span id="Prod2_Nm">xxxx</span></td>
    <td class="whiteSub" width="125"><span id="Prod3_Nm">xxxx</span></td>
    </tr>
    </table>

    Can anyone tell what I need to do to make IE render the <ASP:Table>
    correctly?


    Thanks in advance

    Dave Bennett
    Dave Bennett, Jul 15, 2004
    #1
    1. Advertising

  2. "Dave Bennett" <> wrote in message
    news:%...
    > I am hoping someone can help me because I am really beginning to hate IE.

    <snip>
    > Can anyone tell what I need to do to make IE render the <ASP:Table>
    > correctly?


    Sorry, what's wrong with the way the table is rendering? What's wrong with a
    style attribute?
    --
    John Saunders
    johnwsaundersiii at hotmail
    John Saunders, Jul 15, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Williams
    Replies:
    2
    Views:
    1,120
    Jacob Yang [MSFT]
    Aug 12, 2003
  2. Rio
    Replies:
    4
    Views:
    1,184
  3. Replies:
    6
    Views:
    108
  4. Replies:
    0
    Views:
    82
  5. Ted Byers
    Replies:
    9
    Views:
    204
    Ted Byers
    Dec 4, 2008
Loading...

Share This Page