M
mj.redfox.mj
Can anyone help? I have a textbox which I'm programatically adding by
using the following code:
txtTest = New TextBox
txtTest.ID = "txtLeft" + cntCount.ToString
Page.FindControl("tdInput").Controls.Add(txtTest)
This successfully creates a textbox called "txtLeft1" in the table
cell "tdInput". Now the next thing I'm doing is this:
Dim txtLeft1 As TextBox
txtLeft1 = Page.FindControl("txtLeft1")
txtLeft1.Text = "Computer"
txtLeft1.BackColor = Color.AliceBlue
....which I'm wanting to change the value of the text in the textbox to
"Computer". However, for some reason it doesn't seem to be working. I
know it's almost certainly something really, really obvious but I just
can't see what it is. I included the last line to change the back
colour, just to check that the textbox control is being found by the
script, and it is indeed. The problem is that it just will not set the
text.
Things I've tried so far that either don't work or are spat out by
Visual Studio are:
txtLeft1.Value = "Computer"
txtLeft1.Text.Value = "Computer"
txtLeft1.Text = "Computer".ToString
txtLeft1.Text = "Computer".ToCharArray
txtLeft1.Text = "Computer"
txtLeft1.DataBind()
If anyone can spot the glaringly obvious here, I'd be immensely
grateful!
using the following code:
txtTest = New TextBox
txtTest.ID = "txtLeft" + cntCount.ToString
Page.FindControl("tdInput").Controls.Add(txtTest)
This successfully creates a textbox called "txtLeft1" in the table
cell "tdInput". Now the next thing I'm doing is this:
Dim txtLeft1 As TextBox
txtLeft1 = Page.FindControl("txtLeft1")
txtLeft1.Text = "Computer"
txtLeft1.BackColor = Color.AliceBlue
....which I'm wanting to change the value of the text in the textbox to
"Computer". However, for some reason it doesn't seem to be working. I
know it's almost certainly something really, really obvious but I just
can't see what it is. I included the last line to change the back
colour, just to check that the textbox control is being found by the
script, and it is indeed. The problem is that it just will not set the
text.
Things I've tried so far that either don't work or are spat out by
Visual Studio are:
txtLeft1.Value = "Computer"
txtLeft1.Text.Value = "Computer"
txtLeft1.Text = "Computer".ToString
txtLeft1.Text = "Computer".ToCharArray
txtLeft1.Text = "Computer"
txtLeft1.DataBind()
If anyone can spot the glaringly obvious here, I'd be immensely
grateful!