since you are using inline event handler, this
inside the handler does not refer to the clicked element, it refers the window element so pass the clicked element as an parameter to the handler method as shown below
load_sublocations(this)
then
function load_sublocations(el) {
var gal_location_id = this.value;
var trid = $(el).closest('tr').attr('id');
alert(trid);
}