Question: I am working on asp.net mvc application, After submitting selected date to the database , I want to refresh datepicker , I am able to refresh datepicker only pageload. I dont want to refresh whole page,
I am having input field on popup (datepicker also). On submit button i am using ajax , so the whole page is not refreshed and datepicker holds previous selection, So how can i refresh datepicker.

This is jquery code i am using after ajax 

```
function saveandContinue() {
    if (!validateManageRequestmodel())
        return;
    else
        $("#showerrormsg").hide();

    var model = getManageRequestmodel();
    $.ajax({
        type: "POST",
        url: "AddManageRequest",
        contentType: "application/json",
        data: $.toJSON(model),
        success: function (result) {
            debugger;
            if (result.Status == "ERROR") {
                showErrorMessage('showerrormsg', result.Result);
            }
            else if (result.Status == "OK") {
                showSuccessMessage('showerrormsg', 'Record saved successfully.');
                    **$(".datepicker").datepicker("refresh");**
                iIncrease++;
                if (gsaveParameter === 'add')
                    resetManageRequest();
                else if (gsaveParameter === 'edit') {
                    if (iIncrease < selectedIDs.length)
                        GetDataForEdit(selectedIDs[iIncrease]);
                    else {
                        $('#manageRequestModal').modal('hide');
                        onActionRefreshGrid();
                    }
                }
            }
        },
        error: function (error) {
            debugger;
            showErrorMessage('showerrormsg', error);
        }
    });
}

```

Answer: 
`string::npos` is defined as `constexpr static std::string::size_type string::npos = -1;` (or if it's defined inside the class definition that would be `constexpr static size_type npos = -1;` but that's really irrelevant).

The wraparound of negative numbers converted to unsigned types (`std::string::size_type` is basically `std::size_t`, which is unsigned) is perfectly well-defined by the Standard. `-1` wraps to the largest representable value of the unsigned type, which in your case is `18446744073709551615`. Note that the exact value is implementation-defined because the size of `std::size_t` is implementation-defined (but capable of holding the size of the largest possible array on the system in question).
According to the C++ Standard (Document Number: N3337 or Document Number: N4296) `std::string::npos` is defined the following way

```
static const size_type npos = -1;

```

where std::string::size\_type is some unsigned integer type. So there is nothing wonderful that std::string::npos is equal to -1. The initializer is converted to the tyhpe of `std::string::npos`.

As for this equation

```
(string::npos == ULONG_MAX) is true,

```

then it means that the type `std::string::npos` has type in the used implementation `unsigned long`. This type is usually corresponds to the type `size_t`.

In this equation

```
(18446744073709551615 == -1)

```

The left literal has some unsigned integral type that is appropriate to store such a big literal. Thus the right operand is converted also to this unsigned type by propogating the sign bit. As the left operand represents itself the maximum value of the type then they are equal.