Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Iterate web form textboxes in codebehind page
Message
De
30/09/2003 13:40:57
Jacci Adams
Lindsay-Adams Consulting
Louisville, Ohio, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00833414
Message ID:
00833566
Vues:
18
Cathi,

Thanks! I was just a little off.

Jacci

>Hi Jacci,
>
>There is sample code about iterating through controls in the Feb. 2003 .NET tips. It is the box in the lower left side. Here is the link:
>
>http://www.utmag.com/February2003/Page3.asp
>
>
>>Hi All,
>>
>>I need to iterate through all of the controls on my web form to look for the textboxes and pass their contents to a 3rd party spell checker. I can't seem to find the correct methods to do this or a good example of how to do this. I'm still trying to figure out the object hierarchy.
>>
>>Below is what I have so far:
>>
>>'---------------------------------------------------------------
>> Dim intControl, intCurrentControl As Int32
>> Dim FormItems As Collection
>> Dim strContents, strControlName, strTextBoxValue As String
>> Dim ControlItem As New Control
>> Dim myTextBox As New TextBox
>> Dim myspellchecker As Com.Keyoti.RapidSpell.RapidSpellChecker
>>
>>
>> intControl = 0
>> For Each ControlItem In Me.Page.Controls
>>
>> strControlName = ControlItem.ID.ToUpper
>> If strControlName.Substring(1, 4) = "TEXT" Then
>> '--this control is a textbox spell check it's contents.
>> myTextBox = ControlItem.FindControl(strControlName)
>> strTextBoxValue = myTextBox.Text
>> myspellchecker.Check(strTextBoxValue)
>> End If
>>
>> intControl += 1
>>
>> Next
>>
>>'-----------------------------------------
>>
>>I keep getting this error:
>>Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
>>
>>on this statement:
>>strControlName = ControlItem.ID.ToUpper
>>
>>BTW, what's the syntax for creating code blocks in these messages?
>>
>>I also need some clarification as to when to initialize variables as a "New" type.
>>
>>TIA,
>>Jacci
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform