Pergunta

I am applying localization to my project. I have 2 resource files (.resx) for Arabic and English. I have a resource key “culture ID” in a resource file "GlobalMessages". I need to retrieve data from SQL server by culture id where “1” is for English and “2” for Arabic. I need to set the SQL data source select parameter to the culture id directly. I have set the default value to the resource file key directly but it is not updating when I change the language:

<asp:SqlDataSource ID="DS_Press_Release" runat="server" ConnectionString="<%$ ConnectionStrings:db_websiteConnectionString %>" SelectCommand="Get_PressReleases" SelectCommandType="StoredProcedure">
<SelectParameters>
    <asp:Parameter DefaultValue="<%$Resources: GlobalMessages, Culture_ID %>" Name="Culture_ID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
Foi útil?

Solução

I have stored the culture ID value in a session instead.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top