Last post Apr 09, 2010 03:42 AM by AsM4U
Apr 07, 2010 04:56 AM|AsM4U|LINK
In our web application we need to keep various company's settings. For eg "DiamondProdRefIDCaption","Shippingpickup","ZipCodeCaption","DefaultCountry","AllowToEditInvoice", etc
These settings are different for various companies and are placed in web.config as key-value pair.
Initially, we have tried do simplify this process by adding a company_settings table in the DB so as to allow us to add companies on the fly. However, this method makes it very difficult to add a new setting
since it would require us to add a column to the company_settings table and thus would require code changes as well as stored procedure changes.
Now we want to use resource file to store key-value pair for each compnay. We want to access resources in .aspx file with
DiamondProdRefIDCaption is one of our key in resx file. But, then how we can reset resource file for each company ?
reset default resource file
Apr 09, 2010 01:34 AM|Song-Tian - MSFT|LINK
Please refer to:http://www.c-sharpcorner.com/UploadFile/yougerthen/105032008041615AM/1.aspx .
Apr 09, 2010 01:50 AM|sathish_juk|LINK
Apr 09, 2010 03:42 AM|AsM4U|LINK
Roy and Sathish - Thanks for the links but I think i have a fair understand of what resource files are used for and how to use them.
My question is whether I can dynamically choose which resource file the values are coming from
i.e. CompanyA.resx or CompanyB.resx... and I'd ilke to do this in ASPX files.
To reclarify my question:
We have several companies using one web application. Companies may decide to display different values in Labels.
e.g. CompanyA -> ZipCodeCaption = "Zip Code"
CompanyB -> ZipCodeCaption = "Pin Code"
CompanyA -> USDSymbolCaption = "USD"
CompanyB -> USDSymbolCaption = "$"
Currently, we have different settings saved for different companies in Web.Config->App Settings as key-value pairs. This works okay, but it is very difficult to manage when adding new values.
We'd like to make this more organized by using Global Resource files. i.e. Create one resource file for each company that contains key value pairs. The idea is to then select the resource file on application start based on which company is currently using
However, we don't know how to go about doing this. When we want to use a resource file in an ASPX file, we have to give it the name of the resx file which is specific to a single company. <%$Resources:CompanyA USDSymbolCaption%>
Is there a way we can specify which company to get the Captions from in code behind and not have to write the name of the resx file as specified above.
Is there a better way for us to achieve this without using resource files?