[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>"
Re: Add textbox dynamically into html table tag
Oh God!!
I found why it didn't show up. :eek: I surely will get a headache :eek2:
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??? :cry:
Any idea????
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 ?