locked
How to Set one default resource file from many different resource files in .aspx page ? RRS feed

  • Question

  • User632277935 posted

    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

    <%$Resources:DiamondProdRefIDCaption%>

    DiamondProdRefIDCaption is one of our key in resx file. But, then how we can reset resource file for each company ?

    Wednesday, April 7, 2010 4:56 AM

All replies

  • Friday, April 9, 2010 1:34 AM
  • User632277935 posted

    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.

    <%$Resources:CompanyA USDSymbolCaption%>

    <%$Resources:CompanyB USDSymbolCaption%>


    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 it.

    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?

    Friday, April 9, 2010 3:42 AM