Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Why can't I set the textbox "text" property?? (http://www.velocityreviews.com/forums/t503069-why-cant-i-set-the-textbox-text-property.html)

mj.redfox.mj@gmail.com 04-30-2007 01:45 PM

Why can't I set the textbox "text" property??
 
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!


Ray Costanzo 04-30-2007 02:47 PM

Re: Why can't I set the textbox "text" property??
 
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.mj@gmail.com> wrote in message
news:1177940715.673098.117690@y80g2000hsf.googlegr 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



mj.redfox.mj@gmail.com 04-30-2007 03:03 PM

Re: Why can't I set the textbox "text" property??
 
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:1177940715.673098.117690@y80g2000hsf.googlegr 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 -




Ray Costanzo 04-30-2007 03:14 PM

Re: Why can't I set the textbox "text" property??
 
Not at all. :]

Ray at work

<mj.redfox.mj@gmail.com> wrote in message
news:1177945435.903661.260250@e65g2000hsc.googlegr 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.\



mj.redfox.mj@gmail.com 04-30-2007 03:25 PM

Re: Why can't I set the textbox "text" property??
 
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:1177945435.903661.260250@e65g2000hsc.googlegr 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 -




Ray Costanzo 04-30-2007 03:55 PM

Re: Why can't I set the textbox "text" property??
 
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.mj@gmail.com> wrote in message
news:1177946714.502685.94360@p77g2000hsh.googlegro 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?



mj.redfox.mj@gmail.com 05-01-2007 07:31 AM

Re: Why can't I set the textbox "text" property??
 
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:1177946714.502685.94360@p77g2000hsh.googlegro 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 -




mj.redfox.mj@gmail.com 05-01-2007 07:35 AM

Re: Why can't I set the textbox "text" property??
 
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:1177946714.502685.94360@p77g2000hsh.googlegr 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 -




David 05-01-2007 08:19 AM

Re: Why can't I set the textbox "text" property??
 
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.mj@gmail.com> wrote in message
news:1178004933.278298.234070@c35g2000hsg.googlegr 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:1177946714.502685.94360@p77g2000hsh.googlegr 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 -

>
>




mj.redfox.mj@gmail.com 05-01-2007 11:27 AM

Re: Why can't I set the textbox "text" property??
 
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:1178004933.278298.234070@c35g2000hsg.googlegr 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:1177946714.502685.94360@p77g2000hsh.googlegr 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 -





All times are GMT. The time now is 04:16 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


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