HI
I'm trying to iterate through all the textboxes on a webpage and trim
them for spaces.
i.e. If a user enters " hello world " we correct it to "hello
world"
So far I've come up with this:
----
--
'Trim all textboxes
Dim ThisControl As System.Web.UI.Control
For Each ThisControl In Me.Controls
If ThisControl.GetType().ToString() =
"system.Web.UI.WebControls.TextBox" Then
ThisControl.text = Trim(ThisControl.text)
'Above line is wrong syntax, I want to trim the textbox here, but I'm
stuck! Please help...
End If
Next ThisControl
----
--
Can you help?
Many Thanks!
Alexuse RTrim() and LTrim().
R for right and L for the left side to remove spaces.
"Alex Shirley" <postings@.alexshirley.com> schreef in bericht
news:e9704b08.0406240318.6e352a45@.posting.google.com...
> HI
> I'm trying to iterate through all the textboxes on a webpage and trim
> them for spaces.
> i.e. If a user enters " hello world " we correct it to "hello
> world"
> So far I've come up with this:
> ----
--
> 'Trim all textboxes
> Dim ThisControl As System.Web.UI.Control
> For Each ThisControl In Me.Controls
> If ThisControl.GetType().ToString() =
> "system.Web.UI.WebControls.TextBox" Then
> ThisControl.text = Trim(ThisControl.text)
> 'Above line is wrong syntax, I want to trim the textbox here, but I'm
> stuck! Please help...
> End If
> Next ThisControl
> ----
--
> Can you help?
> Many Thanks!
> Alex
Hi Richard
The problem I have is not really with the trim function. It's the fact
that I cannot update the control text value. It won't allow the .text
property at all in this example because "thiscontrol" is not actually
aware that the control assigned to it is actually a textbox. Is there a
way to tell it it's a textbox so I can access this property, or is there
another way around this?
Any answers folks?
Cheers
Alex
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment