views:

18

answers:

0

In my view I have the following code (for checking if user exists):

    $('#CheckAvailability').click(function () {
        var username = $('#Member_Username').val();
        var oldusername = $('#Member_Oldusername').val();
        if (username != null) {
            $.ajax({
                type: "GET",
                url: "/Admin/Members/CheckAvailability",
                data: "username=" + username + "&oldusername=" + oldusername,
                success: function (data) {
                    $('#DivCheckAvailability').html(data);
                },
                error: function (request, textStatus, errorThrown) {
                    //alert("AJAX error: " + request.statusText);
                }
            });
        }
    });

Controller:

    // check availability
    public string CheckAvailability(string username, string oldusername)
    {
        var sb = new StringBuilder();
        if (Core.IsEmpty(username))
        {
            return sb.AppendFormat("<span class=\"red\">{0}<span>", String.Format(resources.Admin.validation.BlankUsername, username)).ToString();
        }

        if (String.Compare(username, oldusername) != 0)
        {
            Member row = repo.GetMemberByUsername(username);
            if (row != null)
                if (!String.IsNullOrEmpty(row.Username))
                    return sb.AppendFormat("<span class=\"red\">{0}<span>", String.Format(resources.Admin.validation.Username, username)).ToString();
        }
        return sb.AppendFormat("<span class=\"green\">{0}<span>", String.Format(resources.Admin.validation.UsernameAvailable, username)).ToString();
    }

the problem is that the string returned from the resources is always in default english even though my current UICutlure is different. Please help.