I have a page which has a modal pop up which shows on clicking a link button. I have disabled the link button but on clicking the disabled link button also the modal pop up appears. It works fine in all other browsers except Chrome. How to prevent modal pop up from being shown when the link button(target control) is disabled?
The code is given below:
<cc1:ModalPopupExtender ID="ModalPopupExtender" runat="server" BackgroundCssClass="modalBackground"
CancelControlID="imgbtnCancel" DropShadow="true" PopupControlID="panelTenant"
TargetControlID="lnkbtnTenant">
</cc1:ModalPopupExtender>
<asp:Panel ID="panelTenant" CssClass="modalPopup" Style="display: none" Width="400px"
runat="server">
<asp:Button ID="btnTest" Text="Test" runat="server"></asp:Button>
</asp:Panel>
In page_load event of the code, I have checked a condition and disabled the link button when the condition fails.
if (ds.Tables[3].Rows.Count > 0)
{
lnkbtnTenant.Enabled = true;
lnkbtnTenant.Text = "Click to view Tenant Details";
}
else
{
lnkbtnTenant.Enabled = false;
lnkbtnTenant.Text = "Tenant Details not available.";
}
Edited to include the generated-html, posted by OP in the comments:
This is the resulting HTML of the modal pop up:
<div id="ctl00_head_panelTenant" class="modalPopup" style="width:400px;display: none">
<input type="submit" name="ctl00$head$btnTest" value="Test" id="ctl00_head_btnTest"/>
</div>
This is the resulting HTML of the disabled button:
<a id="ctl00_head_lnkbtnTenant" disabled="disabled" class="para1">Tenant Details not available.</a>