Click here to Skip to main content
15,886,095 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">

  
<asp:Button ID="show_popup" runat="server" Text="Show popup" />
 <asp:Label ID="Label1" runat="server">




<ajaxToolkit:ModalPopupExtender ID="mpe" runat="server" TargetControlID="show_popup" PopupControlID="Panel1">
<asp:Panel ID="Panel1" runat="server">
<asp:TextBox ID="TextBox1" runat="server">
  
<asp:Button ID="Button1" runat="server" Text="Button"
onclick="Button1_Click1" />

</form>
</body>
</html>

C#
protected void Button1_Click1(object sender, EventArgs e)
    {
        show_popup.Visible = false;
        Label1.Text = TextBox1.Text;
        mpe.Hide();
    }
Posted

When you use:
C#
show_popup.Visible = false;

you're not just hiding button, it will not be rendered at all. That will cause client side error because extender will not be able to find target control.

Instead try hiding the button with something like this:
C#
show_popup.Style.Add("display", "none");
 
Share this answer
 
 
Share this answer
 
Comments
Rajesh Anuhya 21-Jun-13 5:55am    
This is not an answer, you have to post it as a comment not a soluation.
--RA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900