Hope someone can help with this. I have a form with about
400 objects on it - most of them fall into two types: radio buttons and text
boxes.
In the database, I have a table of values that, for each
item id (1, 2, 3...) there is an associated list of field
names (rbYes, rbNo, mskFirst, mskLast, mskQty). In my
form code, I have a LoadHashTable routine:
Dim Ctrl As Control
Dim SubCtrl As Control
For Each ctrl In Me.pnl01.controls
If Typeof Ctrl Is Panel Then
For Each SubCtrl In Ctrl.controls
gsHashTbl1.Add(Subctrl.Name, SubCtrl)
Next
End If
If (Typeof Ctrl Is C1.Win.C1Input.C1TextBox) Then
gsHashTbl2.Add(SubCtrl.Name, SubCtrl)
End If
Next
What I really need to do is pull the list of objects from
the database via an SP and then pre-load my hashtable
with object name and object type so I can reference them
dynamically in my FindControl subroutine - it's too much
of a hit to load this each and every time a user loads
this form.
My hashtable is declared as a global variable and I
think I should be able to do this, but I don't know how
to translate my LoadHashTable sub into something public.
The reason why is that I would not be iterating through
the pnl01 controls but through a datareader data set from
the database.
I tried several things, none of which worked. What I want
to do is this.
Dim rb As RadioButton
Tim tb As TextBox
For each row in datareader
If DataReader.Value(1) like "%rb%" THen
gsHashTable.Add(CtrlName, rb)
Else
gsHashTable.Add(CtrlName, tb)
End If
Next
What is it I'm missing here? TIA for any/all help