TableCell.Text property overwrites dynamic control

Discussion in 'ASP .Net' started by Bob Voss, Dec 17, 2003.

  1. Bob Voss

    Bob Voss Guest

    If I add a hidden input control to a tablecell and then set the cell's text
    property, the hidden control is not output. If I set the text first, then
    the hidden control is output but the text is not. No errors are generated.
    I can make it work by adding a literal control instead of using the text
    property, but why doesn't the "simple" method work?

    Dim tCell As TableCell = New TableCell
    Dim thidden As HtmlInputHidden = New HtmlInputHidden
    thidden.ID = "h1"
    thidden.Value = "hidden text"
    tCell.Controls.Add(thidden)
    tCell.Text = "visible text"
    tRow.Cells.Add(tCell)
     
    Bob Voss, Dec 17, 2003
    #1
    1. Advertising

  2. Bob Voss

    Joe Molloy Guest

    Maybe add the text as a literal?

    Joe

    "Bob Voss" <> wrote in message
    news:%...
    > If I add a hidden input control to a tablecell and then set the cell's

    text
    > property, the hidden control is not output. If I set the text first, then
    > the hidden control is output but the text is not. No errors are

    generated.
    > I can make it work by adding a literal control instead of using the text
    > property, but why doesn't the "simple" method work?
    >
    > Dim tCell As TableCell = New TableCell
    > Dim thidden As HtmlInputHidden = New HtmlInputHidden
    > thidden.ID = "h1"
    > thidden.Value = "hidden text"
    > tCell.Controls.Add(thidden)
    > tCell.Text = "visible text"
    > tRow.Cells.Add(tCell)
    >
    >
     
    Joe Molloy, Dec 18, 2003
    #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. Brian K. Williams

    TableCell oTableCell = new TableCell(); noWrap?

    Brian K. Williams, Apr 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,593
    Brian K. Williams
    Apr 30, 2004
  2. Nathan Sokalski
    Replies:
    1
    Views:
    1,136
    =?Utf-8?B?SmVk?=
    Apr 29, 2006
  3. DaveyP
    Replies:
    1
    Views:
    1,532
    DaveyP
    May 28, 2008
  4. Nathan Sokalski

    TableCell: BackColor Property But No BackGround Property?

    Nathan Sokalski, Apr 28, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    142
  5. Nathan Sokalski

    TableCell: BackColor Property But No BackGround Property?

    Nathan Sokalski, Apr 28, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    150
Loading...

Share This Page