header image
 

Disabling event source during an ajax postback

Disable radio button after selection but still enable postback : asp.net, javascript

        <script type=”text/javascript”>
             // Get the instance of PageRequestManager.
             var prm = Sys.WebForms.PageRequestManager.getInstance();

             // Add initializeRequest and endRequest
             prm.add_initializeRequest(prm_InitializeRequest);
             prm.add_endRequest(prm_EndRequest);
             
             // Called when async postback begins
             function prm_InitializeRequest(sender, args) {
                  // Disable listitem that caused a postback
                 //$get(args._postBackElement.id).disabled = true;
                 var rbl = document.getElementById(‘<%=RadioButtonList1.ClientID %>’);
                 rbl.disabled = true;
             }
              // Called when async postback ends
             function prm_EndRequest(sender, args) {
                  // Enable listitem that caused a postback
             //    $get(sender._postBackSettings.sourceElement.id).disabled = false;
             }
         </script>

// Get the instance of PageRequestManager.
var prm = Sys.WebForms.PageRequestManager.getInstance();
// Add initializeRequest and endRequest
prm.add_initializeRequest(prm_InitializeRequest);
prm.add_endRequest(prm_EndRequest);

// Called when async postback begins
function prm_InitializeRequest(sender, args) {
// Disable listitem that caused a postback
//$get(args._postBackElement.id).disabled = true;
var rbl = document.getElementById(”);
rbl.disabled = true;
}
// Called when async postback ends
function prm_EndRequest(sender, args) {
// Enable listitem that caused a postback
// $get(sender._postBackSettings.sourceElement.id).disabled = false;
}

~ by shoel on December 14, 2009 .



Leave a Reply