Position of a dynamic table

Discussion in 'ASP .Net Web Controls' started by KSO, Oct 19, 2007.

  1. KSO

    KSO Guest

    By C#-code I want to place a table UNDER my last WEB control - witch I placed
    with the designer.

    My problem is that the table is inserted in the topleft of the IE window -
    on top of my other WEB controls.

    I think the controls must have a position-property but I can't find it.
     
    KSO, Oct 19, 2007
    #1
    1. Advertising

  2. KSO

    Mansi Shah Guest

    Hi,

    It should display dynamic table at the end of all controls.

    And you might have created "Table" dynamically not "HtmlTable", that's
    why it is not displaying Align Property.
    If you use HtmlTable instead Table then you have Align Property which
    you can declare to "Center". Like:

    public void createTable()
    {
    HtmlTable t = new HtmlTable();
    for (int j = 1; j < 3; j++)
    {
    HtmlTableRow row = new HtmlTableRow();
    // Iterate through the cells of a row.
    for (int i = 0; i < 4; i++)
    {
    // Create a new cell and add it to the Cells
    collection.
    HtmlTableCell cell = new HtmlTableCell();
    cell.Controls.Add(new LiteralControl("row " +
    j.ToString() + ", cell " + i.ToString()));
    row.Cells.Add(cell);
    }
    t.Rows.Add(row);
    t.Align = "Center";
    }
    this.Controls.Add(t);
    }

    You can call this function from anywhere in your code.

    Regards,
    Mansi Shah.

    *** Sent via Developersdex http://www.developersdex.com ***
     
    Mansi Shah, Oct 19, 2007
    #2
    1. Advertising

  3. KSO

    KSO Guest

    Thanks Mansi Shan for your time BUT ...

    I want to use "Table" - not "HtmlTable" - and it will work if I place a
    "Table" in the right position by "Design view" and then by code adds rows and
    cells.

    When I can place it this way by "Design view" then "Table" must have a
    position-propterty somewhere, I think - that's the one I'm looking for.

    How can I find it ?

    Best regards
    KSor, Denmark

    "Mansi Shah" wrote:

    >
    > Hi,
    >
    > It should display dynamic table at the end of all controls.
    >
    > And you might have created "Table" dynamically not "HtmlTable", that's
    > why it is not displaying Align Property.
    > If you use HtmlTable instead Table then you have Align Property which
    > you can declare to "Center". Like:
    >
    > public void createTable()
    > {
    > HtmlTable t = new HtmlTable();
    > for (int j = 1; j < 3; j++)
    > {
    > HtmlTableRow row = new HtmlTableRow();
    > // Iterate through the cells of a row.
    > for (int i = 0; i < 4; i++)
    > {
    > // Create a new cell and add it to the Cells
    > collection.
    > HtmlTableCell cell = new HtmlTableCell();
    > cell.Controls.Add(new LiteralControl("row " +
    > j.ToString() + ", cell " + i.ToString()));
    > row.Cells.Add(cell);
    > }
    > t.Rows.Add(row);
    > t.Align = "Center";
    > }
    > this.Controls.Add(t);
    > }
    >
    > You can call this function from anywhere in your code.
    >
    > Regards,
    > Mansi Shah.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    >
     
    KSO, Oct 21, 2007
    #3
    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. Luqman
    Replies:
    1
    Views:
    664
    Luqman
    Feb 7, 2006
  2. Replies:
    1
    Views:
    323
    Lloyd Sheen
    Mar 24, 2008
  3. James Wong
    Replies:
    4
    Views:
    516
    James Wong
    Jul 14, 2004
  4. Ted Byers
    Replies:
    9
    Views:
    215
    Ted Byers
    Dec 4, 2008
  5. Replies:
    3
    Views:
    188
Loading...

Share This Page