If you're database call is happening in getText, that is, you are opening a
connection, getting the single value and closing the connection, then you'll
get a db hit every time you see getText. Of course, you could easily
measure this by (a) debugging your code or (b) profiling your database.
it makes more sense to cache the localized information in a
namevaluecollection. Check if the cache exists, if not, get allstrings from
database and store in namevaluecollection which is then cached...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
<> wrote in message
news: oups.com...
> Hi all,
>
> I've chosen to render localized messages in my web app with using
> databind. Every string has something like this:
>
> <label id="foo" text='<%# getText(LangID, MessageCode) %>'></label>
>
> getText is just a static method we use to retrieve the strings from the
> db by populating a DataReader.
>
> We chose not tu use the new ASP.NET 2 localization features because it
> stores everything in XML and we preferred mantaining our localized
> string in a db.
>
> Performance bottlenecks could also be worked-around by placing a
> DataSet with the localized strings for the most used languages
> (English, Spanish, German, Italian, French, etc...).
>
> My question is: when I call Page.DataBind() how many roundtrips to the
> database are performed? Is it one for every control or just one for the
> whole page?
>
> Do you see any shortcomings with this approach?
>
> Thanks,
> Lorenzo
>