locked
Conditional resource key RRS feed

  • Question

  • User-1695200218 posted

    Hello

    I have a web control (.asxc) that i want to use i two "modes", add and edit

    I would like to change the header label depending on in wich mode the control is, and I would like to change it on asp side, not in the code behind.

    I tried to use a syntax like this (with no success):


    <asp:Label ID="LabelTariffAndTaxGridHeaderKsp" runat="server" CssClass="LabelHeading"

    Text="<%# (Container is GridEditFormInsertItem) ? Resources:RYHTI, KSP_TaxHeader : Resources:RYHTI, KSP_TaxHeader %>"  />


    is it even possible to write code like this, should i put code like this in the code behind??





    Thursday, September 10, 2009 6:47 AM

Answers

  • User191633014 posted

     when you use "<%....  %>"  ... actually this is server side code.

    use next:


    <asp:Label ID="LabelTariffAndTaxGridHeaderKsp" runat="server" CssClass="LabelHeading"/>

    <%= (Container is GridEditFormInsertItem) ?HttpContext.HttpContext.GetGlobalResourceObject("RYHTI", "KSP_TaxHeader").ToString():HttpContext.HttpContext.GetGlobalResourceObject("RYHTI", "KSP_TaxHeader").ToString() %>

    </asp:Label>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 10, 2009 9:13 AM

All replies

  • User191633014 posted

     when you use "<%....  %>"  ... actually this is server side code.

    use next:


    <asp:Label ID="LabelTariffAndTaxGridHeaderKsp" runat="server" CssClass="LabelHeading"/>

    <%= (Container is GridEditFormInsertItem) ?HttpContext.HttpContext.GetGlobalResourceObject("RYHTI", "KSP_TaxHeader").ToString():HttpContext.HttpContext.GetGlobalResourceObject("RYHTI", "KSP_TaxHeader").ToString() %>

    </asp:Label>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 10, 2009 9:13 AM
  • User-1695200218 posted

     Thank you! Works nice...

    Friday, September 11, 2009 12:49 AM