0

im trying to make a user control to popup when a button is clicked! now i dont want to hide the user control and then show it when the button is clicked,

im NOT trying to do this:

test1.aspx

    <uc1:PopUp ID="PopUp1" runat="server" Visible="false" />
    <asp:Button ID="Button1" runat="server" Text="Button" 
         OnClick="Button1_Click" />

test1.aspx.cs

    protected void Button1_Click(object sender, EventArgs e)
    {
        if(PopUp1.Visible==false)
            PopUp1.Visible = true;
        else
            PopUp1.Visible = false;
    }

i want the page loads without it and if the button is clicked it fires! is it possible?

btw, im open to any other suggestion other than using user control

thank you in advance

CodeMonkey
  • 2,511
  • 4
  • 27
  • 38
  • 1
    You can use jquery UI dialog and show your html in a popup. Closing div etc will be done out of the box. – qamar May 23 '14 at 08:14
  • 1
    _"if the button is clicked it fires"_ what means _fires_ in this context? How can a `UserControl` fire? You know that `Visible=false` means that there is no html rendered at all on clientside? – Tim Schmelter May 23 '14 at 08:17
  • 1
    Use a `Placeholder` control. See [Custom user control to add dynamically](http://stackoverflow.com/questions/2275625/asp-net-custom-user-control-to-add-dynamically) and [Adding User Control Dynamically in ASP.NET](http://stackoverflow.com/questions/9718008/adding-user-control-dynamically-in-asp-net) – JW Lim May 23 '14 at 08:18
  • tq guys....they all helped me very well. but can i develop the question more and you help me on that a lil bit? – CodeMonkey May 23 '14 at 08:32
  • The asp will not render the control to client it is visible false – Amen Ayach May 23 '14 at 08:34
  • lets say i have 10 buttons in the page that each shows a different data of requirement for something. now i want to show 1 popup where it reads the data from XML file and fill it in the popup when the appropriate button is clicked! – CodeMonkey May 23 '14 at 08:36

0 Answers0