Last post Aug 09, 2010 10:25 AM by caesar123
Aug 09, 2010 05:55 AM|caesar123|LINK
I have a table for labels in SQL server, in this table i hold all the text for all the labels i use in my website. The reason i am doing this is because i creating a bilingual site, which will display two languages on one page at the same time. The other
language being arabic.
So what this means is that whenever a page loads, it needs to go and fetch the text of the labels from the database to display them on the page.
the way i have done this is that i have created a class called labels, and in this class i have created two methods, one called GetEnglishLabel(ID) and the Other Called GetArabicLabel(ID). Both methods take an ID, which corresponds to the id in the sql server
database. Each of these functions is using LinqToSql to get the text for the label for the given ID.
My problem is that for every label i need to call this function, so as you might imagine on one page i might have over a hundred calls to these functions on page_load.
Although this works, i have noticed a delay when accessing this page. Im sure this is the reason and hence i would be grateful if somebody could help me with a solution for this.
An idea may be to return the whole table on page load, and then call the labels from this table held in memory, or something like that, but i am not sure how to implement that in asp.net.
Any help will be mush appreciated.
linq to sql
Aug 09, 2010 07:13 AM|vik20000in|LINK
you can cache the data or keep the data in session if data is user specific.
Aug 09, 2010 10:25 AM|caesar123|LINK
Data is not user specific.
i was looking into ways of how i can hold that data in datatable, and then just reference the datatable in memory to return the column value for the given row.
However i seem to be struggling to get the right syntax