Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Why can't I set the textbox "text" property??

Reply
Thread Tools

Why can't I set the textbox "text" property??

 
 
mj.redfox.mj@gmail.com
Guest
Posts: n/a
 
      04-30-2007
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!

 
Reply With Quote
 
 
 
 
Ray Costanzo
Guest
Posts: n/a
 
      04-30-2007
Your code works for me.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim txtTest As TextBox
Dim cntCount As Integer = 1
txtTest = New TextBox
txtTest.ID = "txtLeft" + cntCount.ToString
Page.FindControl("tdInput").Controls.Add(txtTest)
Dim txtLeft1 As TextBox
txtLeft1 = Page.FindControl("txtLeft1")
txtLeft1.Text = "Computer"
txtLeft1.BackColor = Drawing.Color.AliceBlue
End Sub


May I suggest that instead of creating a textbox, adding it, and then
creating a new instance of a textbox that is the same one, you just set the
text and color when you create the initial textbox?


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim txtTest As TextBox
Dim cntCount As Integer = 1
txtTest = New TextBox
txtTest.ID = "txtLeft" + cntCount.ToString
txtTest.BackColor = Drawing.Color.AliceBlue
txtTest.Text = "Computer"
Page.FindControl("tdInput").Controls.Add(txtTest)
End Sub

Ray at work



<> wrote in message
news: oups.com...
> 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


 
Reply With Quote
 
 
 
 
mj.redfox.mj@gmail.com
Guest
Posts: n/a
 
      04-30-2007
Thanks Ray, at least you've shown I wasn't too far off the right track
I guess!

I'll give that a shot.


On 30 Apr, 15:47, "Ray Costanzo" <my first name at lane 34 dot
commercial> wrote:
> Your code works for me.
>
> *Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> * Dim txtTest As TextBox
> * Dim cntCount As Integer = 1
> * txtTest = New TextBox
> * txtTest.ID = "txtLeft" + cntCount.ToString
> * Page.FindControl("tdInput").Controls.Add(txtTest)
> * Dim txtLeft1 As TextBox
> * txtLeft1 = Page.FindControl("txtLeft1")
> * txtLeft1.Text = "Computer"
> * txtLeft1.BackColor = Drawing.Color.AliceBlue
> *End Sub
>
> May I suggest that instead of creating a textbox, adding it, and then
> creating a new instance of a textbox that is the same one, you just set the
> text and color when you create the initial textbox?
>
> *Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> * Dim txtTest As TextBox
> * Dim cntCount As Integer = 1
> * txtTest = New TextBox
> * txtTest.ID = "txtLeft" + cntCount.ToString
> * txtTest.BackColor = Drawing.Color.AliceBlue
> * txtTest.Text = "Computer"
> * Page.FindControl("tdInput").Controls.Add(txtTest)
> *End Sub
>
> Ray at work
>
> <mj.redfox...@gmail.com> wrote in message
>
> news: oups.com...
>
>
>
> > 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- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
Ray Costanzo
Guest
Posts: n/a
 
      04-30-2007
Not at all. :]

Ray at work

<> wrote in message
news: oups.com...
Thanks Ray, at least you've shown I wasn't too far off the right track
I guess!

I'll give that a shot.


On 30 Apr, 15:47, "Ray Costanzo" <my first name at lane 34 dot
commercial> wrote:
> Your code works for me.\


 
Reply With Quote
 
mj.redfox.mj@gmail.com
Guest
Posts: n/a
 
      04-30-2007
Hmmmm. The textboxes (there are a few of them created by a FOR...NEXT
loop) are actually behaving VERY weirdly, using your suggestion I can
now assign a text value to all but the first two, even though the loop
handles them all identically!!????

I'll have another look tomorrow and then report back as this may be
useful for other people in the future. I wonder if dynamic generated
form elements are just unstable in general?


On 30 Apr, 16:14, "Ray Costanzo" <my first name at lane 34 dot
commercial> wrote:
> Not at all. :]
>
> Ray at work
>
> <mj.redfox...@gmail.com> wrote in message
>
> news: oups.com...
> Thanks Ray, at least you've shown I wasn't too far off the right track
> I guess!
>
> I'll give that a shot.
>
> On 30 Apr, 15:47, "Ray Costanzo" <my first name at lane 34 dot
>
>
>
> commercial> wrote:
> > Your code works for me.\- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
Ray Costanzo
Guest
Posts: n/a
 
      04-30-2007
It's possible that what you're trying to do can be done with an entirely
different approach. If you want to post snippets of ASPX and .VB that would
be enough for us to duplicate what you're doing, maybe someone could offer
some alternate routes if they'd seem appropriate.

Ray at work

<> wrote in message
news: ups.com...
> Hmmmm. The textboxes (there are a few of them created by a FOR...NEXT
> loop) are actually behaving VERY weirdly, using your suggestion I can
> now assign a text value to all but the first two, even though the loop
> handles them all identically!!????
>
> I'll have another look tomorrow and then report back as this may be
> useful for other people in the future. I wonder if dynamic generated
> form elements are just unstable in general?


 
Reply With Quote
 
mj.redfox.mj@gmail.com
Guest
Posts: n/a
 
      05-01-2007
OK, here's the code behind page in full. I didn't post this originally
as it's in a very 'quick and dirty' state at the moment, and needs
tidied, commented and the variables renamed...but this is what I've
been working with It basically adds a variable number of table cells
and textboxes within them, based on the value of 'intAttributes'.
Using this, for some reason I can only set properties of textboxes
txtLeft2 - txtLeft8 (or whatever the upper limit is) - any attempt to
programmatically change the initial text in textboxes txtTest0 or
txtTest1 has no effect. Very, very strange.


Partial Class _ShowData
Inherits System.Web.UI.Page

Sub Page_Load(ByVal Sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strTemplate As String
Dim intAttributes As Integer
Dim txtTest As TextBox
Dim trTest As TableRow
Dim tdTest As TableCell
Dim cntCount As Integer

strTemplate = ""
intAttributes = 1

If Page.IsPostBack Then
If Page.Request.Params.Get("__EVENTTARGET") =
"DropDownList1" Then
strTemplate = DropDownList1.Text
Select Case DropDownList1.Text
Case "Computer"
intAttributes = 8
Case "Generic"
intAttributes = 6
End Select
End If
End If

For cntCount = 1 To intAttributes

trTest = New TableRow
trTest.ID = "trSpecification" + cntCount.ToString
Page.FindControl("tblSpecification").Controls.Add( trTest)

tdTest = New TableCell
tdTest.ID = "tdSpecificationLeft" + cntCount.ToString
Page.FindControl("trSpecification" +
cntCount.ToString).Controls.Add(tdTest)

tdTest = New TableCell
tdTest.ID = "tdSpecificationRight" + cntCount.ToString
Page.FindControl("trSpecification" +
cntCount.ToString).Controls.Add(tdTest)

txtTest = New TextBox
txtTest.ID = "txtLeft" + cntCount.ToString
If strTemplate = "Computer" Then
If cntCount = 0 Then
txtTest.Text = "Test Text 0"
End If
If cntCount = 1 Then
txtTest.Text = "Test Text 1"
End If
If cntCount = 2 Then
txtTest.Text = "Test Text 2"
End If
End If
Page.FindControl("tdSpecificationLeft" +
cntCount.ToString).Controls.Add(txtTest)

txtTest = New TextBox
txtTest.ID = "txtRight" + cntCount.ToString
Page.FindControl("tdSpecificationRight" +
cntCount.ToString).Controls.Add(txtTest)

Next

End Sub



On 30 Apr, 16:55, "Ray Costanzo" <my first name at lane 34 dot
commercial> wrote:
> It's possible that what you're trying to do can be done with an entirely
> different approach. If you want to post snippets of ASPX and .VB that would
> be enough for us to duplicate what you're doing, maybe someone could offer
> some alternate routes if they'd seem appropriate.
>
> Ray at work
>
> <mj.redfox...@gmail.com> wrote in message
>
> news: ups.com...
>
>
>
> > Hmmmm. The textboxes (there are a few of them created by a FOR...NEXT
> > loop) are actually behaving VERY weirdly, using your suggestion I can
> > now assign a text value to all but the first two, even though the loop
> > handles them all identically!!????

>
> > I'll have another look tomorrow and then report back as this may be
> > useful for other people in the future. I wonder if dynamic generated
> > form elements are just unstable in general?- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
mj.redfox.mj@gmail.com
Guest
Posts: n/a
 
      05-01-2007
QUICK ADD: For some reason, in the above I've accidentally deleted the
line where if 'Computer' is selected in the drop-down list, then
strTemplate is set to "Computer". Sorry about that, the important
point in the above is that the line that adds the text to textbox
txtLeft2 works fine, so I just need to figure out what is so 'special'
about textboxes 1 and 2...


On 1 May, 08:31, mj.redfox...@gmail.com wrote:
> OK, here's the code behind page in full. I didn't post this originally
> as it's in a very 'quick and dirty' state at the moment, and needs
> tidied, commented and the variables renamed...but this is what I've
> been working with It basically adds a variable number of table cells
> and textboxes within them, based on the value of 'intAttributes'.
> Using this, for some reason I can only set properties of textboxes
> txtLeft2 - txtLeft8 (or whatever the upper limit is) - any attempt to
> programmatically change the initial text in textboxes txtTest0 or
> txtTest1 has no effect. Very, very strange.
>
> Partial Class _ShowData
> Inherits System.Web.UI.Page
>
> Sub Page_Load(ByVal Sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
> Dim strTemplate As String
> Dim intAttributes As Integer
> Dim txtTest As TextBox
> Dim trTest As TableRow
> Dim tdTest As TableCell
> Dim cntCount As Integer
>
> strTemplate = ""
> intAttributes = 1
>
> If Page.IsPostBack Then
> If Page.Request.Params.Get("__EVENTTARGET") =
> "DropDownList1" Then
> strTemplate = DropDownList1.Text
> Select Case DropDownList1.Text
> Case "Computer"
> intAttributes = 8
> Case "Generic"
> intAttributes = 6
> End Select
> End If
> End If
>
> For cntCount = 1 To intAttributes
>
> trTest = New TableRow
> trTest.ID = "trSpecification" + cntCount.ToString
> Page.FindControl("tblSpecification").Controls.Add( trTest)
>
> tdTest = New TableCell
> tdTest.ID = "tdSpecificationLeft" + cntCount.ToString
> Page.FindControl("trSpecification" +
> cntCount.ToString).Controls.Add(tdTest)
>
> tdTest = New TableCell
> tdTest.ID = "tdSpecificationRight" + cntCount.ToString
> Page.FindControl("trSpecification" +
> cntCount.ToString).Controls.Add(tdTest)
>
> txtTest = New TextBox
> txtTest.ID = "txtLeft" + cntCount.ToString
> If strTemplate = "Computer" Then
> If cntCount = 0 Then
> txtTest.Text = "Test Text 0"
> End If
> If cntCount = 1 Then
> txtTest.Text = "Test Text 1"
> End If
> If cntCount = 2 Then
> txtTest.Text = "Test Text 2"
> End If
> End If
> Page.FindControl("tdSpecificationLeft" +
> cntCount.ToString).Controls.Add(txtTest)
>
> txtTest = New TextBox
> txtTest.ID = "txtRight" + cntCount.ToString
> Page.FindControl("tdSpecificationRight" +
> cntCount.ToString).Controls.Add(txtTest)
>
> Next
>
> End Sub
>
> On 30 Apr, 16:55, "Ray Costanzo" <my first name at lane 34 dot
>
>
>
> commercial> wrote:
> > It's possible that what you're trying to do can be done with an entirely
> > different approach. If you want to post snippets of ASPX and .VB that would
> > be enough for us to duplicate what you're doing, maybe someone could offer
> > some alternate routes if they'd seem appropriate.

>
> > Ray at work

>
> > <mj.redfox...@gmail.com> wrote in message

>
> >news: oups.com...

>
> > > Hmmmm. The textboxes (there are a few of them created by a FOR...NEXT
> > > loop) are actually behaving VERY weirdly, using your suggestion I can
> > > now assign a text value to all but the first two, even though the loop
> > > handles them all identically!!????

>
> > > I'll have another look tomorrow and then report back as this may be
> > > useful for other people in the future. I wonder if dynamic generated
> > > form elements are just unstable in general?- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
David
Guest
Posts: n/a
 
      05-01-2007
cntCount will never be 0 as you start it from 1.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available


<> wrote in message
news: oups.com...
> QUICK ADD: For some reason, in the above I've accidentally deleted the
> line where if 'Computer' is selected in the drop-down list, then
> strTemplate is set to "Computer". Sorry about that, the important
> point in the above is that the line that adds the text to textbox
> txtLeft2 works fine, so I just need to figure out what is so 'special'
> about textboxes 1 and 2...
>
>
> On 1 May, 08:31, mj.redfox...@gmail.com wrote:
>> OK, here's the code behind page in full. I didn't post this originally
>> as it's in a very 'quick and dirty' state at the moment, and needs
>> tidied, commented and the variables renamed...but this is what I've
>> been working with It basically adds a variable number of table cells
>> and textboxes within them, based on the value of 'intAttributes'.
>> Using this, for some reason I can only set properties of textboxes
>> txtLeft2 - txtLeft8 (or whatever the upper limit is) - any attempt to
>> programmatically change the initial text in textboxes txtTest0 or
>> txtTest1 has no effect. Very, very strange.
>>
>> Partial Class _ShowData
>> Inherits System.Web.UI.Page
>>
>> Sub Page_Load(ByVal Sender As System.Object, ByVal e As
>> System.EventArgs) Handles MyBase.Load
>>
>> Dim strTemplate As String
>> Dim intAttributes As Integer
>> Dim txtTest As TextBox
>> Dim trTest As TableRow
>> Dim tdTest As TableCell
>> Dim cntCount As Integer
>>
>> strTemplate = ""
>> intAttributes = 1
>>
>> If Page.IsPostBack Then
>> If Page.Request.Params.Get("__EVENTTARGET") =
>> "DropDownList1" Then
>> strTemplate = DropDownList1.Text
>> Select Case DropDownList1.Text
>> Case "Computer"
>> intAttributes = 8
>> Case "Generic"
>> intAttributes = 6
>> End Select
>> End If
>> End If
>>
>> For cntCount = 1 To intAttributes
>>
>> trTest = New TableRow
>> trTest.ID = "trSpecification" + cntCount.ToString
>> Page.FindControl("tblSpecification").Controls.Add( trTest)
>>
>> tdTest = New TableCell
>> tdTest.ID = "tdSpecificationLeft" + cntCount.ToString
>> Page.FindControl("trSpecification" +
>> cntCount.ToString).Controls.Add(tdTest)
>>
>> tdTest = New TableCell
>> tdTest.ID = "tdSpecificationRight" + cntCount.ToString
>> Page.FindControl("trSpecification" +
>> cntCount.ToString).Controls.Add(tdTest)
>>
>> txtTest = New TextBox
>> txtTest.ID = "txtLeft" + cntCount.ToString
>> If strTemplate = "Computer" Then
>> If cntCount = 0 Then
>> txtTest.Text = "Test Text 0"
>> End If
>> If cntCount = 1 Then
>> txtTest.Text = "Test Text 1"
>> End If
>> If cntCount = 2 Then
>> txtTest.Text = "Test Text 2"
>> End If
>> End If
>> Page.FindControl("tdSpecificationLeft" +
>> cntCount.ToString).Controls.Add(txtTest)
>>
>> txtTest = New TextBox
>> txtTest.ID = "txtRight" + cntCount.ToString
>> Page.FindControl("tdSpecificationRight" +
>> cntCount.ToString).Controls.Add(txtTest)
>>
>> Next
>>
>> End Sub
>>
>> On 30 Apr, 16:55, "Ray Costanzo" <my first name at lane 34 dot
>>
>>
>>
>> commercial> wrote:
>> > It's possible that what you're trying to do can be done with an
>> > entirely
>> > different approach. If you want to post snippets of ASPX and .VB that
>> > would
>> > be enough for us to duplicate what you're doing, maybe someone could
>> > offer
>> > some alternate routes if they'd seem appropriate.

>>
>> > Ray at work

>>
>> > <mj.redfox...@gmail.com> wrote in message

>>
>> >news: oups.com...

>>
>> > > Hmmmm. The textboxes (there are a few of them created by a FOR...NEXT
>> > > loop) are actually behaving VERY weirdly, using your suggestion I can
>> > > now assign a text value to all but the first two, even though the
>> > > loop
>> > > handles them all identically!!????

>>
>> > > I'll have another look tomorrow and then report back as this may be
>> > > useful for other people in the future. I wonder if dynamic generated
>> > > form elements are just unstable in general?- Hide quoted text -

>>
>> > - Show quoted text -- Hide quoted text -

>>
>> - Show quoted text -

>
>



 
Reply With Quote
 
mj.redfox.mj@gmail.com
Guest
Posts: n/a
 
      05-01-2007
I've tried it from 0 though for testing purposes, again couldn't set
the text for that textbox but could for all the ones from 2 onwards.


On 1 May, 09:19, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
> cntCount will never be 0 as you start it from 1.
>
> --
> Best regards,
> Dave Colliver.http://www.AshfieldFOCUS.com
> ~~http://www.FOCUSPortals.com- Local franchises available
>
> <mj.redfox...@gmail.com> wrote in message
>
> news: oups.com...
>
>
>
> > QUICK ADD: For some reason, in the above I've accidentally deleted the
> > line where if 'Computer' is selected in the drop-down list, then
> > strTemplate is set to "Computer". Sorry about that, the important
> > point in the above is that the line that adds the text to textbox
> > txtLeft2 works fine, so I just need to figure out what is so 'special'
> > about textboxes 1 and 2...

>
> > On 1 May, 08:31, mj.redfox...@gmail.com wrote:
> >> OK, here's the code behind page in full. I didn't post this originally
> >> as it's in a very 'quick and dirty' state at the moment, and needs
> >> tidied, commented and the variables renamed...but this is what I've
> >> been working with It basically adds a variable number of table cells
> >> and textboxes within them, based on the value of 'intAttributes'.
> >> Using this, for some reason I can only set properties of textboxes
> >> txtLeft2 - txtLeft8 (or whatever the upper limit is) - any attempt to
> >> programmatically change the initial text in textboxes txtTest0 or
> >> txtTest1 has no effect. Very, very strange.

>
> >> Partial Class _ShowData
> >> Inherits System.Web.UI.Page

>
> >> Sub Page_Load(ByVal Sender As System.Object, ByVal e As
> >> System.EventArgs) Handles MyBase.Load

>
> >> Dim strTemplate As String
> >> Dim intAttributes As Integer
> >> Dim txtTest As TextBox
> >> Dim trTest As TableRow
> >> Dim tdTest As TableCell
> >> Dim cntCount As Integer

>
> >> strTemplate = ""
> >> intAttributes = 1

>
> >> If Page.IsPostBack Then
> >> If Page.Request.Params.Get("__EVENTTARGET") =
> >> "DropDownList1" Then
> >> strTemplate = DropDownList1.Text
> >> Select Case DropDownList1.Text
> >> Case "Computer"
> >> intAttributes = 8
> >> Case "Generic"
> >> intAttributes = 6
> >> End Select
> >> End If
> >> End If

>
> >> For cntCount = 1 To intAttributes

>
> >> trTest = New TableRow
> >> trTest.ID = "trSpecification" + cntCount.ToString
> >> Page.FindControl("tblSpecification").Controls.Add( trTest)

>
> >> tdTest = New TableCell
> >> tdTest.ID = "tdSpecificationLeft" + cntCount.ToString
> >> Page.FindControl("trSpecification" +
> >> cntCount.ToString).Controls.Add(tdTest)

>
> >> tdTest = New TableCell
> >> tdTest.ID = "tdSpecificationRight" + cntCount.ToString
> >> Page.FindControl("trSpecification" +
> >> cntCount.ToString).Controls.Add(tdTest)

>
> >> txtTest = New TextBox
> >> txtTest.ID = "txtLeft" + cntCount.ToString
> >> If strTemplate = "Computer" Then
> >> If cntCount = 0 Then
> >> txtTest.Text = "Test Text 0"
> >> End If
> >> If cntCount = 1 Then
> >> txtTest.Text = "Test Text 1"
> >> End If
> >> If cntCount = 2 Then
> >> txtTest.Text = "Test Text 2"
> >> End If
> >> End If
> >> Page.FindControl("tdSpecificationLeft" +
> >> cntCount.ToString).Controls.Add(txtTest)

>
> >> txtTest = New TextBox
> >> txtTest.ID = "txtRight" + cntCount.ToString
> >> Page.FindControl("tdSpecificationRight" +
> >> cntCount.ToString).Controls.Add(txtTest)

>
> >> Next

>
> >> End Sub

>
> >> On 30 Apr, 16:55, "Ray Costanzo" <my first name at lane 34 dot

>
> >> commercial> wrote:
> >> > It's possible that what you're trying to do can be done with an
> >> > entirely
> >> > different approach. If you want to post snippets of ASPX and .VB that
> >> > would
> >> > be enough for us to duplicate what you're doing, maybe someone could
> >> > offer
> >> > some alternate routes if they'd seem appropriate.

>
> >> > Ray at work

>
> >> > <mj.redfox...@gmail.com> wrote in message

>
> >> >news: oups.com...

>
> >> > > Hmmmm. The textboxes (there are a few of them created by a FOR...NEXT
> >> > > loop) are actually behaving VERY weirdly, using your suggestion I can
> >> > > now assign a text value to all but the first two, even though the
> >> > > loop
> >> > > handles them all identically!!????

>
> >> > > I'll have another look tomorrow and then report back as this may be
> >> > > useful for other people in the future. I wonder if dynamic generated
> >> > > form elements are just unstable in general?- Hide quoted text -

>
> >> > - Show quoted text -- Hide quoted text -

>
> >> - Show quoted text -- Hide quoted text -

>
> - Show quoted text -



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Why does putting focus on textbox also set focus to submit jw56578@gmail.com Javascript 2 06-06-2005 08:20 PM
runat="server"....a simple html textbox or a webform server textbox...that is the question. Hazzard ASP .Net 2 07-23-2003 07:32 AM
Re: VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail??? S. Justin Gengo ASP .Net 0 07-16-2003 06:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57