Skip to content

Instantly share code, notes, and snippets.

@dandean
Created January 29, 2010 22:56
Show Gist options
  • Select an option

  • Save dandean/290238 to your computer and use it in GitHub Desktop.

Select an option

Save dandean/290238 to your computer and use it in GitHub Desktop.
// Here you go Bess. Let me know if you have any questions.
/**
* ChangeMonth([e]) -> "undefined"
* - e (HTMLSelectChangeEvent): Optional, provided when this function is an event handler on a select element.
**/
function ChangeMonth(e){
// Get the select element and its current value.
var select = $('<%= this.monthListControl.ClientId_Dropdown %>'),
selectedMonth = select.value;
// Stop the event, if provided. There will be no event if called manually.
// I don't see why this would be needed though...
if (e) e.stop();
if(selectedMonth != '' && selectedMonth != currentMonth){
currentMonth = selectedMonth;
// Post asynchronously, pass `name` as the target. `name` is the same as .Net's UniqueID.
Page.post({target: select.name});
}
}
if (selectedMonthCookie) {
if(selectedMonthCookie != currentMonth){
currentMonth = selectedMonthCookie;
// Change month if necessary. ChangeMonth will work itself out internally.
ChangeMonth();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment