
 static public string DropDownListSelectChangeConfirmScript(string dropDownListId,string message)
static public string DropDownListSelectChangeConfirmScript(string dropDownListId,string message)

 {
{ string script = " <script> \n"
    string script = " <script> \n" +" var fooIndex; \n"
        +" var fooIndex; \n" +" function saveIndexes() \n"
        +" function saveIndexes() \n" +" { \n"
        +" { \n" +"    fooIndex = document.all['"+dropDownListId+"'].selectedIndex; \n"
        +"    fooIndex = document.all['"+dropDownListId+"'].selectedIndex; \n" +" } \n"
        +" } \n" +" function resetIndexes() \n"
        +" function resetIndexes() \n" +" { \n"
        +" { \n" +"    document.all['"+dropDownListId+"'].selectedIndex = fooIndex; \n"
        +"    document.all['"+dropDownListId+"'].selectedIndex = fooIndex; \n" +" } \n"
        +" } \n" +" function areYouSure() \n"
        +" function areYouSure() \n" +" { \n"
        +" { \n" +"    if( !confirm('"+message+"')) \n"
        +"    if( !confirm('"+message+"')) \n" +"    { \n"
        +"    { \n" +"      resetIndexes(); \n"
        +"      resetIndexes(); \n" +"      return false; \n"
        +"      return false; \n" +"    } \n"
        +"    } \n" +"    else \n"
        +"    else \n" +"    { \n"
        +"    { \n" +"      document.all['"+dropDownListId+"'].detachEvent('onchange', areYouSure); \n"
        +"      document.all['"+dropDownListId+"'].detachEvent('onchange', areYouSure); \n" +"      return true; \n"
        +"      return true; \n" +"    } \n"
        +"    } \n" +" } \n"
        +" } \n" +" saveIndexes(); \n"
        +" saveIndexes(); \n" +" document.all['"+dropDownListId+"'].attachEvent('onchange', areYouSure); "
        +" document.all['"+dropDownListId+"'].attachEvent('onchange', areYouSure); " +"</script>\n";
        +"</script>\n"; return script;
    return script; }
} private void RegisterClientScript(string dropDownListClientId)
private void RegisterClientScript(string dropDownListClientId)

 {
{ string script = DropDownListSelectChangeConfirmScript(
    string script = DropDownListSelectChangeConfirmScript( dropDownListClientId,
        dropDownListClientId, "Are you sure?"
        "Are you sure?" );
        ); if(!IsStartupScriptRegistered("startup"))
    if(!IsStartupScriptRegistered("startup"))
 
     {
{ RegisterStartupScript("startup",script);
        RegisterStartupScript("startup",script); }
    }
 }
}