Wednesday, March 28, 2012

where does hashtable gets created

I store all my label keys in hashtable, We got like more than 1400 labels in the table.(Localization)

I use the hashtable at the front end aspx webforms.

Just out of curiosity i want to know where does the hashtable gets created.

Thank you.Depends on the way you code it. Can you provide us with some code please ?
Here is the code: i have ten labels on my form and all the names are coming from the Table.

This is done for vb.net form, but i want to use the same for asp.net web form's
We have more than 1400 labels with three lang's.
Soul Assasin if you have any more ideas on Localization methods please post. Thank you very much.
***************
mycon = New SqlConnection(strcon)

'instantiate the commands
mycmd = New SqlCommand(sql, mycon)
mycon.Open()

myadapter = New SqlDataAdapter(mycmd)

mydataset.Clear()

myadapter.Fill(mydataset)

'Now i am going to fill the data
Dim ht As New Hashtable
ht.Clear()

Dim sid As String
Dim sName As String
Dim Row

For Each Row In mydataset.Tables(0).Rows
sName = Trim(Row.Item("lbl_name"))
sid = Trim(Row.Item("lbl_id"))

ht.Add(sid, sName)
Next

'the following are the five labels they get the names from table
L001.Text = ht("L001")
L002.Text = ht("L002")
L003.Text = ht("L003")
L004.Text = ht("L004")
L005.Text = ht("L005")
L006.Text = ht("L006")
L007.Text = ht("L007")
L008.Text = ht("L008")
L009.Text = ht("L009")
L0010.Text = ht("L0010")

0 comments:

Post a Comment