Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 12 of 12

Thread: String Resource

  1. #1
    pkdang is offline Junior Member
    Join Date
    Aug 2009
    Posts
    16

    Default String Resource

    I'm trying to use an image as a value and I put the html code and it works fine, but when I view it on the site. It just shows the html code for the image. Is there away to make it show?

  2. #2
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Where are trying to put it? Could you elaborate the issue a little bit?

  3. #3
    pkdang is offline Junior Member
    Join Date
    Aug 2009
    Posts
    16

    Default

    I'm trying to use the button as a replacement of text on a input button for the shopping cart. It had the text "Checkout" but I have a button image that says "Proceed to Checkout". And I was putting the image as the value in the admin section of aspdnsf I would use CSS but i feel that the ID of the Button is similar but in different areas with different text. Am I going about the wrong with this?
    Last edited by pkdang; 08-14-2009 at 12:44 PM.

  4. #4
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Correct me if I'm wrong but you're trying to use image to replace the Checkout button, right?

  5. #5
    pkdang is offline Junior Member
    Join Date
    Aug 2009
    Posts
    16

    Default

    Yes, I attached some screenshots to show you want I mean.
    Attached Images Attached Images   

  6. #6
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    If you intend to modify the Checkout button and I believe you're modifying the shoppingcart.aspx page. You could just change the asp.net button control to asp.net image control, rather than using the string resource.

  7. #7
    Dusty is offline Member
    Join Date
    Jun 2009
    Posts
    176

    Default

    To elaborate, unfortunately, you can't use an HTML tag as a string resource in this context, which is why you're seeing the HTML you entered on the checkout page, but the actual button on the admin site. The reason this isn't working the way you expect is on the customer facing side of the site we HTMLEncode all dynamic values we display on the page. Not doing so would leave the site vulnerable Cross-Site Scripting attacks. While you can change the text of the checkout button, to change the button itself you need to change such in the code rather than the string resource.

    Dusty
    ASPDotNetStorefront Staff
    Last edited by Dusty; 08-14-2009 at 01:24 PM. Reason: Clarifying

  8. #8
    pkdang is offline Junior Member
    Join Date
    Aug 2009
    Posts
    16

    Default

    So I try inserted this code to show the button as an image

    Code:
     <asp:ImageButton ImageUrl="skins/Skin_1/curo_images/proceed_checkout.jpg" runat="server" ID="btnCheckOutNowTop" onCommand="btnCheckOutNowTop_Click" />
    This is the original
    Code:
    <asp:Button ID="btnCheckOutNowTop" Text="(!shoppingcart.cs.111!)" runat="server" CssClass="CheckoutNowButton" />
    But I get this error

    Code:
    Compiler Error Message: CS0029: Cannot implicitly convert type 'System.EventHandler' to 'System.Web.UI.ImageClickEventHandler'
    
    Source Error:
    
    Line 144:            btnContinueShoppingTop.Click += new EventHandler(btnContinueShoppingTop_Click);
    Line 145:            btnContinueShoppingBottom.Click += new EventHandler(btnContinueShoppingBottom_Click);
    Line 146:            btnCheckOutNowTop.Click += new EventHandler(btnCheckOutNowTop_Click);
    Line 147:            btnCheckOutNowBottom.Click += new EventHandler(btnCheckOutNowBottom_Click);
    Line 148:            btnInternationalCheckOutNowTop.Click += new EventHandler(btnInternationalCheckOutNowTop_Click);
    What am I doing wrong? I'm really new to asp.net

  9. #9
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    A little modification needed. First, you must change the onCommand="btnCheckOutNowTop_Click" to
    Code:
    OnClick="btnCheckOutNowTop_Click"
    Then, search and comment the following lines out on the shoppingcart.aspx.cs:
    Code:
    btnCheckOutNowTop.Click += new EventHandler(btnCheckOutNowTop_Click);
    btnCheckOutNowTop.Text = AppLogic.GetString("shoppingcart.cs.111", SkinID, ThisCustomer.LocaleSetting);
    Lastly, change this line:
    void btnCheckOutNowTop_Click(object sender, EventArgs e)

    to:

    Code:
    protected void btnCheckOutNowTop_Click(object sender, System.Web.UI.ImageClickEventArgs e)
    and that should be it...
    Last edited by Jao; 08-17-2009 at 10:08 AM.

  10. #10
    pkdang is offline Junior Member
    Join Date
    Aug 2009
    Posts
    16

    Default

    It Works! Thanks for the help!

  11. #11
    PowerProducts is offline Member
    Join Date
    Oct 2010
    Location
    Spokane, WA
    Posts
    40

    Default

    I have not found
    btnCheckOutNowTop.Click += new EventHandler(btnCheckOutNowTop_Click);
    I found the .text code but not the .click code

    I get the error:
    Code:
    Parser Error
    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
    
    Parser Error Message: The base class includes the field 'btnCheckOutNowTop', but its type (System.Web.UI.WebControls.Button) is not compatible with the type of control (System.Web.UI.WebControls.ImageButton).
    
    Source Error:
    
    Line 33:                     <td valign="center" align="right">
    Line 34:                         <asp:Button ID="btnContinueShoppingTop" Text="<%$ Tokens:StringResource,shoppingcart.cs.62 %>" CssClass="ContinueShoppingButton" runat="server" />&#160;
    Line 35: 						<asp:ImageButton ImageUrl="App_Themes/Skin_1/proceed_checkout.png" runat="server" ID="btnCheckOutNowTop" OnClick="btnCheckOutNowTop_Click" />&#160;
    Line 36:                         <asp:Button ID="btnQuickCheckoutTop" Text="<%$ Tokens:StringResource,shoppingcart.cs.111a %>" Visible="false" runat="server" CssClass="CheckoutNowButton" />
    Line 37:                         <asp:Button ID="btnInternationalCheckOutNowTop" Visible="false" Text="<%$ Tokens:StringResource,shoppingcart.cs.111b %>" runat="server" CssClass="CheckoutNowButton" />&#160;
    
    
    Source File: /shoppingcart.aspx    Line: 35
    Last edited by PowerProducts; 09-30-2011 at 02:06 PM.
    Currently running 9.3 Multistore on 5 sites.

  12. #12
    PowerProducts is offline Member
    Join Date
    Oct 2010
    Location
    Spokane, WA
    Posts
    40

    Default

    Anyone have any ideas?
    This forum is frustrating, it is hard to get support.
    Currently running 9.3 Multistore on 5 sites.