function OnGridSelectionChanged(Type) {
    if (Type == 1) {
        gvUnAssignedUsers.GetSelectedFieldValues('UserId', OnGridSelectionCompleteUnAssUsr);
    }
    if (Type == 2) {
        gvAssignedUsers.GetSelectedFieldValues('UserId', OnGridSelectionCompleteAssUsr);
    }
}

function OnGridSelectionCompleteUnAssUsr(values) {
    var counter = document.getElementById("hdnUsersToBeAssigned");
    counter.value = '';
    for (var i = 0; i < values.length; i++) {
        counter.value = counter.value + values[i] + ',';
    }
}

function OnGridSelectionCompleteAssUsr(values) {
    var counter = document.getElementById("hdnUsersToBeUnassinged");
    counter.value = '';
    for (var i = 0; i < values.length; i++) {
        counter.value = counter.value + values[i] + ',';
    }
}