Results 1 to 3 of 3

Thread: [RESOLVED] Add textbox dynamically into html table tag

  1. #1

    Thread Starter
    Addicted Member scsfdev's Avatar
    Join Date
    Feb 2008
    Location
    Singapore
    Posts
    224

    Resolved [RESOLVED] Add textbox dynamically into html table tag

    Hi,

    can I know how can I add a textbox into HTML table at code behind?
    Currently, I tried to add one. but instead of textbox, it shows up a gray box in that cells. (can't edit or enter any value) it appear a gray box like a label.

    anyone have any idea?
    thanks.

    P.S: how I add textbox into table is like:

    Code:
    Dim txtBox As String = "<asp:TextBox style=""Z-INDEX: 0"" id=""TextBox3"" runat=""server""></asp:TextBox>"
    
    Dim dCol As String = "<TD class=""NormalTxt"" style="............"> txtBox </TD>"
    Last edited by scsfdev; May 14th, 2009 at 10:36 PM. Reason: Add Sample Coding
    I'm using VS 2005 & 2008 & 2010 with SQL Server 2005 Express.

    My hobby beside programming: http://dslrstranger.wordpress.com

  2. #2

    Thread Starter
    Addicted Member scsfdev's Avatar
    Join Date
    Feb 2008
    Location
    Singapore
    Posts
    224

    Re: Add textbox dynamically into html table tag

    Oh God!!
    I found why it didn't show up. I surely will get a headache

    The previous developer wrote all these HTML tag in a string format. And then she put it as label.text = xxxx.
    So, although I put a textbox in that html tag, it will not show up cuz its container is label's text preperties!!!

    When I try a new page and use label.controls.add(text box control), it shows up OK!

    Oh My God!!!
    That's mean I need to re-do this whole page starts from beginning???
    Any idea????
    I'm using VS 2005 & 2008 & 2010 with SQL Server 2005 Express.

    My hobby beside programming: http://dslrstranger.wordpress.com

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Add textbox dynamically into html table tag

    From your code. I under stand that you are trying to output a control using a string content. If you say yes then you go for the Page.ParseControl method to print a control from the string

    This code will output a Button control in the form

    Code:
      Sub Page_Load(sender As Object, e As System.EventArgs)
           Dim c As Control 
           c = ParseControl("<asp:button text='Click here!' runat='server' />")
           myPlaceholder.Controls.Add(c)
        End Sub 'Page_Load
    Page.ParseControl

    Can't you do this way ?
    Please mark you thread resolved using the Thread Tools as shown

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width