I have a web page on which one can select a report and a printer to which to print, and then choose to print the report with a button. The button should be disabled until both a report and printer are selected. I use this to do so:
Protected Sub PrintButtonUseability()
btnPrint.Enabled = ddlPrinters.SelectedText.Length > 0 AndAlso rgWebReports.SelectedIndexes.Count > 0
End Sub
Debugging indicates it is being set properly. But if I select something from ddlPrinters
and then select something from rgWebReports
, it turns out that, even though stepping through the code that btnPrint.Enabled
is set to False
, the button is disabled! Strangely, if I select from rgWebReports
first and then select from ddlPrinters
then it works as expected.
Additional information that seemed irrelevant was that I'm using a RadAjaxManager
to clearly show the page is busy when retrieving data, especially when selecting a report.
It turns out, as I was about to post this question, I had a suspicion: maybe the delay somehow caused something to go haywire. Here is my RadAjaxManager
:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="ddlPrinters">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="pnlPrint" />
<telerik:AjaxUpdatedControl ControlID="btnPrint" />
<telerik:AjaxUpdatedControl ControlID="rgWebReports" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
For some reason, removing the btnPrint
and rgWebReports
resolved my issue, and it works correctly. I am at a loss to explain exactly why it works, though.