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: 
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.
This is all about signed overflow and the fact that negative numbers are stored as 2s complement. The means that to get the absolute value of a negative number, you invert all the bits and add one. Meaning when doing an 8 bit comparison 255 and -1 have the same binary value of 11111111. The same applies to bigger integers

<https://en.m.wikipedia.org/wiki/Two%27s_complement>