Recently while working with Ajax ModalPopupExtender control, I got the below error: "JavaScript runtime error: Unable to get property 'parentNode' of undefined or null reference".
Also you can check my previous articles on:
- Partial class in C#.Net
- Left outer join and Right outer join in SQL Server
- alert() method examples in JavaScript
Reason:
I was showing the ModalPopupExtender from the code behind file on a button click like below:
And my panel code was like below:
Here the problem was the Visible="false" attribute of the Pannel.
Solution:
I removed the Visible="false" attribute from the Pannel and it started working.
You can check out this article on how to show ModalPopupExtender in code behind in Ajax in Asp.Net.
Hope it will work for you.
Also you can check my previous articles on:
- Partial class in C#.Net
- Left outer join and Right outer join in SQL Server
- alert() method examples in JavaScript
Reason:
I was showing the ModalPopupExtender from the code behind file on a button click like below:
protected void btnClick_Click(object
sender, EventArgs e)
{
this.ModalPopupExtender1.Show();
pnlPopupMsg.Visible = true;
}
<asp:Panel ID="pnlPopupMsg"
runat="server"
CssClass="modalPopup"
Visible="false">
<asp:Label ID="lblMessage" runat="server" Text="Here is the message which will come!!!"></asp:Label><br />
<br />
<asp:Button ID="btnYes" runat="server" Text="Yes" OnClick="btnYes_Click" />
<asp:Button ID="btnNo" runat="server" Text="NO" OnClick="btnNo_Click" />
</asp:Panel>Here the problem was the Visible="false" attribute of the Pannel.
Solution:
I removed the Visible="false" attribute from the Pannel and it started working.
You can check out this article on how to show ModalPopupExtender in code behind in Ajax in Asp.Net.
Hope it will work for you.