473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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!

Apr 30 '07 #1
16 5115
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**********@gmail.comwrote in message
news:11**********************@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
Apr 30 '07 #2
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
commercialwrote:
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.comwrote in message

news:11**********************@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 -

Apr 30 '07 #3
Not at all. :]

Ray at work

<mj**********@gmail.comwrote in message
news:11**********************@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
commercialwrote:
Your code works for me.\
Apr 30 '07 #4
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
commercialwrote:
Not at all. :]

Ray at work

<mj.redfox...@gmail.comwrote in message

news:11**********************@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

commercialwrote:
Your code works for me.\- Hide quoted text -

- Show quoted text -

Apr 30 '07 #5
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**********@gmail.comwrote in message
news:11*********************@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?
Apr 30 '07 #6
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
commercialwrote:
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.comwrote in message

news:11*********************@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 -

May 1 '07 #7
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

commercialwrote:
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.comwrote in message
news:11*********************@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 -- Hide quoted text -

- Show quoted text -

May 1 '07 #8
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**********@gmail.comwrote in message
news:11**********************@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

commercialwrote:
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.comwrote in message
>news:11*********************@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 -


May 1 '07 #9
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.comwrote in message

news:11**********************@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
commercialwrote:
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.comwrote in message
news:11*********************@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 -- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

May 1 '07 #10
Someone has just told me that I may need to add the textboxes to the
form collection in the Page_Init routine, rather than the Page_Load.

HOWEVER...having just tried this by changing the above code to handle
Page_Init instead, this gives another problem...although it still
recognizes a postback, and even that DropDownList1 is the
'__EVENTTARGET', it can no longer get the VALUE submitted by
DropDownList1 (whereas in Page_Load it can) - and getting that value
is absolutely critical to how this page works. So I'm not sure that
Page_Init is the answer...I'll keep trying though :(
On 1 May, 12:27, mj.redfox...@gmail.com wrote:
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.comwrote in message
news:11**********************@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
>commercialwrote:
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.comwrote in message
>news:11*********************@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 -- Hide quoted text -

- Show quoted text -

May 1 '07 #11
Something else I have just noticed... you can test around this.

You have two if statements around your switch case. If you cannot get past
either of these if statements, then your intAttributes will never be more
than one.

So, ignore the case statement, set specifically intAttributes to a value
afterwards, see what happens. In fact, I was not aware DropDownList had a
..Text value. I always use either .SelectedText, .SelectedValue or
..SelectedIndex. If I am correct, then your intAtrribute value will not be
being set.

You really need to step through your code to see if the values you expect
are correct at certain points. Especially in the loop. Just re-reading your
code again, if I am correct on the DropDownList, then that will ensure that
0, 1 and 2 settings are not being set, as strTemplate will be an empty
string.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
<mj**********@gmail.comwrote in message
news:11**********************@y5g2000hsa.googlegro ups.com...
Someone has just told me that I may need to add the textboxes to the
form collection in the Page_Init routine, rather than the Page_Load.

HOWEVER...having just tried this by changing the above code to handle
Page_Init instead, this gives another problem...although it still
recognizes a postback, and even that DropDownList1 is the
'__EVENTTARGET', it can no longer get the VALUE submitted by
DropDownList1 (whereas in Page_Load it can) - and getting that value
is absolutely critical to how this page works. So I'm not sure that
Page_Init is the answer...I'll keep trying though :(
On 1 May, 12:27, mj.redfox...@gmail.com wrote:
>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.comwrote in message
>news:11**********************@c35g2000hsg.googleg roups.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
>commercialwrote:
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.comwrote in message
>news:11*********************@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 -- Hide quoted text -

- Show quoted text -


May 1 '07 #12
Hi David

Thanks for replying, you're absolutely correct about those two key
'checkpoints' in the code; the bottom line after doing all sorts of
tests appears to be that if I have the above code in Page_Init and
hard-code the number of textboxes, plus their text values, then it
works, but I can't get the postback submission from the drop down list
(as obviously this info is not available at Page_Init) - if I put the
code in Page_Load, then I DO get the drop-down list postback, but I
believe by this time it's then too late to add the dynamic controls to
the page, as this needs to be done at Page_Init. I guess this is
what's referred to as 'Catch 22'!

Looks like I'm going to have to re-write this whole thing some other
way, which is a real shame as I would have loved to have got this
working dynamically, plus it would have been better coding practice.

It's a classic example of being unable to achieve something in .NET
that would have taken fifteen minutes flat in Classic ASP and
Javascript - very frustrating.
On 1 May, 16:11, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
Something else I have just noticed... you can test around this.

You have two if statements around your switch case. If you cannot get past
either of these if statements, then your intAttributes will never be more
than one.

So, ignore the case statement, set specifically intAttributes to a value
afterwards, see what happens. In fact, I was not aware DropDownList had a
.Text value. I always use either .SelectedText, .SelectedValue or
.SelectedIndex. If I am correct, then your intAtrribute value will not be
being set.

You really need to step through your code to see if the values you expect
are correct at certain points. Especially in the loop. Just re-reading your
code again, if I am correct on the DropDownList, then that will ensure that
0, 1 and 2 settings are not being set, as strTemplate will be an empty
string.
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com- Local franchises available

<mj.redfox...@gmail.comwrote in message

news:11**********************@y5g2000hsa.googlegro ups.com...
Someone has just told me that I may need to add the textboxes to the
form collection in the Page_Init routine, rather than the Page_Load.
HOWEVER...having just tried this by changing the above code to handle
Page_Init instead, this gives another problem...although it still
recognizes a postback, and even that DropDownList1 is the
'__EVENTTARGET', it can no longer get the VALUE submitted by
DropDownList1 (whereas in Page_Load it can) - and getting that value
is absolutely critical to how this page works. So I'm not sure that
Page_Init is the answer...I'll keep trying though :(
On 1 May, 12:27, mj.redfox...@gmail.com wrote:
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-Localfranchises available
<mj.redfox...@gmail.comwrote in message
news:11**********************@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
>commercialwrote:
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.comwrote in message
>news:11*********************@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 -- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

May 1 '07 #13
Can't you create the textboxes prior to reading the dropdown?

create text box
read dropdown
enable/disable/assign values to textbox based on drop down
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

<mj**********@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
Hi David

Thanks for replying, you're absolutely correct about those two key
'checkpoints' in the code; the bottom line after doing all sorts of
tests appears to be that if I have the above code in Page_Init and
hard-code the number of textboxes, plus their text values, then it
works, but I can't get the postback submission from the drop down list
(as obviously this info is not available at Page_Init) - if I put the
code in Page_Load, then I DO get the drop-down list postback, but I
believe by this time it's then too late to add the dynamic controls to
the page, as this needs to be done at Page_Init. I guess this is
what's referred to as 'Catch 22'!

Looks like I'm going to have to re-write this whole thing some other
way, which is a real shame as I would have loved to have got this
working dynamically, plus it would have been better coding practice.

It's a classic example of being unable to achieve something in .NET
that would have taken fifteen minutes flat in Classic ASP and
Javascript - very frustrating.
On 1 May, 16:11, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
>Something else I have just noticed... you can test around this.

You have two if statements around your switch case. If you cannot get
past
either of these if statements, then your intAttributes will never be more
than one.

So, ignore the case statement, set specifically intAttributes to a value
afterwards, see what happens. In fact, I was not aware DropDownList had a
.Text value. I always use either .SelectedText, .SelectedValue or
.SelectedIndex. If I am correct, then your intAtrribute value will not be
being set.

You really need to step through your code to see if the values you expect
are correct at certain points. Especially in the loop. Just re-reading
your
code again, if I am correct on the DropDownList, then that will ensure
that
0, 1 and 2 settings are not being set, as strTemplate will be an empty
string.
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com- Local franchises available

<mj.redfox...@gmail.comwrote in message

news:11**********************@y5g2000hsa.googlegr oups.com...
Someone has just told me that I may need to add the textboxes to the
form collection in the Page_Init routine, rather than the Page_Load.
HOWEVER...having just tried this by changing the above code to handle
Page_Init instead, this gives another problem...although it still
recognizes a postback, and even that DropDownList1 is the
'__EVENTTARGET', it can no longer get the VALUE submitted by
DropDownList1 (whereas in Page_Load it can) - and getting that value
is absolutely critical to how this page works. So I'm not sure that
Page_Init is the answer...I'll keep trying though :(
On 1 May, 12:27, mj.redfox...@gmail.com wrote:
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-Localfranchises available
<mj.redfox...@gmail.comwrote in message
>news:11**********************@c35g2000hsg.googleg roups.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
>commercialwrote:
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.comwrote in message
>news:11*********************@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 -- Hide quoted text -
>- Show quoted text -- Hide quoted text -

- Show quoted text -


May 1 '07 #14
Not really, because the value of the dropdown (readable in Page_Load)
determines how many textboxes I need to dynamically create (in
Page_Init). I'm struggling to see a way around this to be honest.
On 1 May, 16:44, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
Can't you create the textboxes prior to reading the dropdown?

create text box
read dropdown
enable/disable/assign values to textbox based on drop down

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

<mj.redfox...@gmail.comwrote in message

news:11**********************@q75g2000hsh.googlegr oups.com...
Hi David
Thanks for replying, you're absolutely correct about those two key
'checkpoints' in the code; the bottom line after doing all sorts of
tests appears to be that if I have the above code in Page_Init and
hard-code the number of textboxes, plus their text values, then it
works, but I can't get the postback submission from the drop down list
(as obviously this info is not available at Page_Init) - if I put the
code in Page_Load, then I DO get the drop-down list postback, but I
believe by this time it's then too late to add the dynamic controls to
the page, as this needs to be done at Page_Init. I guess this is
what's referred to as 'Catch 22'!
Looks like I'm going to have to re-write this whole thing some other
way, which is a real shame as I would have loved to have got this
working dynamically, plus it would have been better coding practice.
It's a classic example of being unable to achieve something in .NET
that would have taken fifteen minutes flat in Classic ASP and
Javascript - very frustrating.
On 1 May, 16:11, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
Something else I have just noticed... you can test around this.
You have two if statements around your switch case. If you cannot get
past
either of these if statements, then your intAttributes will never be more
than one.
So, ignore the case statement, set specifically intAttributes to a value
afterwards, see what happens. In fact, I was not aware DropDownList had a
.Text value. I always use either .SelectedText, .SelectedValue or
.SelectedIndex. If I am correct, then your intAtrribute value will not be
being set.
You really need to step through your code to see if the values you expect
are correct at certain points. Especially in the loop. Just re-reading
your
code again, if I am correct on the DropDownList, then that will ensure
that
0, 1 and 2 settings are not being set, as strTemplate will be an empty
string.
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com-Local franchises available
<mj.redfox...@gmail.comwrote in message
>news:11**********************@y5g2000hsa.googlegr oups.com...
Someone has just told me that I may need to add the textboxes to the
form collection in the Page_Init routine, rather than the Page_Load.
HOWEVER...having just tried this by changing the above code to handle
Page_Init instead, this gives another problem...although it still
recognizes a postback, and even that DropDownList1 is the
'__EVENTTARGET', it can no longer get the VALUE submitted by
DropDownList1 (whereas in Page_Load it can) - and getting that value
is absolutely critical to how this page works. So I'm not sure that
Page_Init is the answer...I'll keep trying though :(
On 1 May, 12:27, mj.redfox...@gmail.com wrote:
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-Localfranchisesavailable
<mj.redfox...@gmail.comwrote in message
news:11**********************@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
>commercialwrote:
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.comwrote in message
>news:11*********************@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 -- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

May 2 '07 #15
I think I may have just stumbled on the answer. It appears the code
needs to be in a DropDownList1_SelectedIndexChanged routine - the
reason I hadn't done this previously was that everything else I'd read
suggested I needed to insert the code in Page_Init - ah well, upwards
and onwards...and thanks for your help along the way guys.
On 2 May, 08:00, mj.redfox...@gmail.com wrote:
Not really, because the value of the dropdown (readable in Page_Load)
determines how many textboxes I need to dynamically create (in
Page_Init). I'm struggling to see a way around this to be honest.

On 1 May, 16:44, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
Can't you create the textboxes prior to reading the dropdown?
create text box
read dropdown
enable/disable/assign values to textbox based on drop down
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com-Local franchises available
<mj.redfox...@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
Hi David
Thanks for replying, you're absolutely correct about those two key
'checkpoints' in the code; the bottom line after doing all sorts of
tests appears to be that if I have the above code in Page_Init and
hard-code the number of textboxes, plus their text values, then it
works, but I can't get the postback submission from the drop down list
(as obviously this info is not available at Page_Init) - if I put the
code in Page_Load, then I DO get the drop-down list postback, but I
believe by this time it's then too late to add the dynamic controls to
the page, as this needs to be done at Page_Init. I guess this is
what's referred to as 'Catch 22'!
Looks like I'm going to have to re-write this whole thing some other
way, which is a real shame as I would have loved to have got this
working dynamically, plus it would have been better coding practice.
It's a classic example of being unable to achieve something in .NET
that would have taken fifteen minutes flat in Classic ASP and
Javascript - very frustrating.
On 1 May, 16:11, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
>Something else I have just noticed... you can test around this.
>You have two if statements around your switch case. If you cannot get
>past
>either of these if statements, then your intAttributes will never bemore
>than one.
>So, ignore the case statement, set specifically intAttributes to a value
>afterwards, see what happens. In fact, I was not aware DropDownList had a
>.Text value. I always use either .SelectedText, .SelectedValue or
>.SelectedIndex. If I am correct, then your intAtrribute value will not be
>being set.
>You really need to step through your code to see if the values you expect
>are correct at certain points. Especially in the loop. Just re-reading
>your
>code again, if I am correct on the DropDownList, then that will ensure
>that
>0, 1 and 2 settings are not being set, as strTemplate will be an empty
>string.
>--
>Best regards,
>Dave Colliver.http://www.AshfieldFOCUS.com
>~~http://www.FOCUSPortals.com-Localfranchises available
><mj.redfox...@gmail.comwrote in message
>>news:11**********************@y5g2000hsa.googleg roups.com...
Someone has just told me that I may need to add the textboxes to the
form collection in the Page_Init routine, rather than the Page_Load.
HOWEVER...having just tried this by changing the above code to handle
Page_Init instead, this gives another problem...although it still
recognizes a postback, and even that DropDownList1 is the
'__EVENTTARGET', it can no longer get the VALUE submitted by
DropDownList1 (whereas in Page_Load it can) - and getting that value
is absolutely critical to how this page works. So I'm not sure that
Page_Init is the answer...I'll keep trying though :(
On 1 May, 12:27, mj.redfox...@gmail.com wrote:
>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-Localfranchisesavailable
<mj.redfox...@gmail.comwrote in message
>news:11**********************@c35g2000hsg.googleg roups.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
>commercialwrote:
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.comwrote in message
>news:11*********************@p77g2000hsh.googlegr oups.com...
Hmmmm. The textboxes (there are a few of them created bya
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

...

read more »- Hide quoted text -

- Show quoted text -

May 2 '07 #16
Put the code in a seperate function. Get your selectedindexchanged to call
that function. That way, you can call the function any other time as well
(i.e. what happens when no selectedindexchanged event occurs, for example,
initial load of the page).

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
<mj**********@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
I think I may have just stumbled on the answer. It appears the code
needs to be in a DropDownList1_SelectedIndexChanged routine - the
reason I hadn't done this previously was that everything else I'd read
suggested I needed to insert the code in Page_Init - ah well, upwards
and onwards...and thanks for your help along the way guys.
On 2 May, 08:00, mj.redfox...@gmail.com wrote:
Not really, because the value of the dropdown (readable in Page_Load)
determines how many textboxes I need to dynamically create (in
Page_Init). I'm struggling to see a way around this to be honest.

On 1 May, 16:44, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
Can't you create the textboxes prior to reading the dropdown?
create text box
read dropdown
enable/disable/assign values to textbox based on drop down
--
Best regards,
Dave Colliver.http://www.AshfieldFOCUS.com
~~http://www.FOCUSPortals.com-Local franchises available
<mj.redfox...@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
Hi David
Thanks for replying, you're absolutely correct about those two key
'checkpoints' in the code; the bottom line after doing all sorts of
tests appears to be that if I have the above code in Page_Init and
hard-code the number of textboxes, plus their text values, then it
works, but I can't get the postback submission from the drop down list
(as obviously this info is not available at Page_Init) - if I put the
code in Page_Load, then I DO get the drop-down list postback, but I
believe by this time it's then too late to add the dynamic controls to
the page, as this needs to be done at Page_Init. I guess this is
what's referred to as 'Catch 22'!
Looks like I'm going to have to re-write this whole thing some other
way, which is a real shame as I would have loved to have got this
working dynamically, plus it would have been better coding practice.
It's a classic example of being unable to achieve something in .NET
that would have taken fifteen minutes flat in Classic ASP and
Javascript - very frustrating.
On 1 May, 16:11, "David" <david.colliver.N...@revilloc.REMOVETHIS.com>
wrote:
>Something else I have just noticed... you can test around this.
>You have two if statements around your switch case. If you cannot get
>past
>either of these if statements, then your intAttributes will never be
>more
>than one.
>So, ignore the case statement, set specifically intAttributes to a
>value
>afterwards, see what happens. In fact, I was not aware DropDownList
>had a
>.Text value. I always use either .SelectedText, .SelectedValue or
>.SelectedIndex. If I am correct, then your intAtrribute value will
>not be
>being set.
>You really need to step through your code to see if the values you
>expect
>are correct at certain points. Especially in the loop. Just
>re-reading
>your
>code again, if I am correct on the DropDownList, then that will
>ensure
>that
>0, 1 and 2 settings are not being set, as strTemplate will be an
>empty
>string.
>--
>Best regards,
>Dave Colliver.http://www.AshfieldFOCUS.com
>~~http://www.FOCUSPortals.com-Localfranchises available
><mj.redfox...@gmail.comwrote in message
>>news:11**********************@y5g2000hsa.googleg roups.com...
Someone has just told me that I may need to add the textboxes to
the
form collection in the Page_Init routine, rather than the
Page_Load.
HOWEVER...having just tried this by changing the above code to
handle
Page_Init instead, this gives another problem...although it still
recognizes a postback, and even that DropDownList1 is the
'__EVENTTARGET', it can no longer get the VALUE submitted by
DropDownList1 (whereas in Page_Load it can) - and getting that
value
is absolutely critical to how this page works. So I'm not sure that
Page_Init is the answer...I'll keep trying though :(
On 1 May, 12:27, mj.redfox...@gmail.com wrote:
>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-Localfranchisesavailable
<mj.redfox...@gmail.comwrote in message
>news:11**********************@c35g2000hsg.googleg roups.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
>commercialwrote:
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.comwrote in message
>news:11*********************@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

...

read more »- Hide quoted text -

- Show quoted text -


May 2 '07 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alexander | last post by:
I am building a little unique dialog editor and have derived some new classes like DButton, DLabel and DTextBox. The user adds these Controls to a panel which is part of a class Document which is...
4
by: David Kyle | last post by:
Hello there, I'm having some problems setting the TextBox.Text Property in my code and having it returned to the client in the source when the TextBox.TextMode="Password". I know this is...
4
by: Bill Rowell | last post by:
This question is driving me nuts because I'm sure its easy to do... If I have a text box control and a user enters some text with new line characters in it, how could I turn around and parse that...
5
by: DCSTech | last post by:
On my webpage I have a textbox. I would like to be able to change the text in the textbox and via a pushbutton have the value in the textbox written to the .text property so that next time the...
2
by: nhaydon | last post by:
There has to be way to do this. Any help would be appreciated. Here is the code. txtReturn.Text = data + Environment.NewLine + data + Environment.NewLine + data + Environment.NewLine + data +...
2
by: korean44 | last post by:
A beginner in C# .. I wrote 2 classes like below.. (psuedo code) public class FormUI : System.Windows.Forms.Form { public TextBox tbResult = new TextBox(); ...
4
by: Finn Stampe Mikkelsen | last post by:
Hi Is there any way to make the textbox property show html, like a textarea on a webpage would?? I have a webapplication that saves an textarea complete with html tags and everything... ...
3
nev
by: nev | last post by:
my textbox displays "hello" i change the value of textbox through code like this: textbox.text = "" then i do: bindingsource.endedit() tableadapter.update(dataset.datatable)
5
by: cyrak | last post by:
This should be fairly trivial I think..but is not working. I have a textbox that i add at runtime TextBox tagText = new TextBox(); then i put it in a panel' ...
1
by: kostareject | last post by:
Hello! Can anyone tell me how can I printi label/textbox Text property in MDI Child by clicking MDI Parent print button in C#! I have MDI Chil form with several labels and textboxes, and I want...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.