Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tommy 3 posts 23 karma points
    Aug 11, 2009 @ 14:04
    Tommy
    0

    localize asp:login

    Hi!

    I have recently started to play around with umbraco and I am now trying to localize the <asp:login> tag. I have converted it to a layout template and I assign my language related strings in the following way

    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" CssClass="block">
    <umbraco:Item field="userName" textIfEmpty="User Name:" insertTextAfter=":" runat="server"></umbraco:Item>
    </asp:Label>

    But when I reached the <asp:CheckBox> I steped in to a can of trouble. I can't assign the Text property of the checkbox in the same way that I do above. Am I doing this the wrong way or is there an easy solution to this? To be really clear what I want to do is replace the "Remember me next time" with my own property (in this case called rememberMe).

    <asp:CheckBox runat="server" ID="RememberMe" Text='Remember the next time' />
  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 11, 2009 @ 14:27
    Dirk De Grave
    0

    Tommy,

    you can use the RememberMeText property on the asp.net login control to localize the text...

    <asp:Login RememberMeText="String" />

    In your case, you don't actually need to convert it to a Layout template... (altho it's best practice to get rid off of those table/tr/td tags)

    A full overview of all props that can be set on the login control can be found here

     

    Cheers,

    /Dirk

     

  • Tommy 3 posts 23 karma points
    Aug 11, 2009 @ 14:36
    Tommy
    0

    Hi Dirk!

    Thanks for the quick reply!
    Still some problems though. I do want to convert it to a Layout template, just as you said to get rid of the table madness, and even if I don't convert it I still can't assign the RememberMeText property my own value. 

    What I want to do is something like this

    <asp:Login runat="server" RememberMeText="<umbraco:Item field='rememberMe' textIfEmpty='Remember me next time.' runat='server'></umbraco:Item>" />

    But that doesn't work.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 11, 2009 @ 15:01
    Dirk De Grave
    0

    Honestly, haven't tried it that way before, but think following snippet may work:

    <asp:Login runat="server" RememberMeText='<%=umbraco.cms.nodeFactory.Node.GetCurrent().GetProperty("rememberMe").Value%>' />

    (It doesn't solve you fallback scenario tho in case value is empty)

    Cheers,

    /Dirk

     

  • Tommy 3 posts 23 karma points
    Aug 11, 2009 @ 15:45
    Tommy
    0

    Hmm, it didn't work, just got an empty string back (Tried it by itself outside of the <asp:login> tag also and then I got the value).
    Maybe I am approaching this the wrong way. I think I need to read up on the documentation :)

    Thanks for the help Dirk!

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 11, 2009 @ 16:29
    Dirk De Grave
    0

    Hi Tommy,

    you could use Page_Load event and set RememberMe text on the login control (You can script that functionality in your template). Be sure to set ID property on the login control, otherwise it'll fail.

     

    Cheers,

    /Dirk

     

  • Julius Bartkus 51 posts 76 karma points
    Sep 29, 2009 @ 13:39
    Julius Bartkus
    0

    Hi Tommy,

    I had the same problem and I found a solution through Page_Load

    protected void Page_Load(object sender, EventArgs e) { 

        ((Button)LoginControl.FindControl("LoginButton")).Text = umbraco.library.GetDictionaryItem("loginLoginButtonText");

    ..........

    <asp:Login ID="LoginControl".........
        <LayoutTemplate>..........
            <asp:Button ID="LoginButton" ..........

Please Sign in or register to post replies

Write your reply to:

Draft