Vishweshwar Kapse
Vishweshwar Kapse

Reputation: 939

opening a popup window on click of a button which is in a user control

I am trying to open a window on click of a button that is inside a user control my user control, but the window is not opening when i click on the button the button simply disapears and the page hangs. can anybody help me please.

my code is like this

           <asp:TableCell>
           <asp:ButtonID="btnSearch"Text="Search"OnClientClick="open();"runat="server"/>
    </asp:TableCell>

  <script type = "text/javascript>
     function open() {
    window.open("OnPopUp.aspx");
    return true;
     }
    </script>

Upvotes: 0

Views: 6178

Answers (2)

user1990587
user1990587

Reputation: 386

Use this code

 <asp:TableCell>
       <asp:Button ID="btnSearch" Text="Search" OnClientClick="openwd();" runat="server"/>
  </asp:TableCell>


 <script type = "text/javascript>
   function openwd() {
   window.open("OnPopUp.aspx");
   return false;
   }
  </script>

Upvotes: 1

Md. Arafat Al Mahmud
Md. Arafat Al Mahmud

Reputation: 3214

user controls in asp.net has the extension .ascx . In your example you r calling OnPopUp.aspx, rather it should be OnPopUp.ascx

Upvotes: 0

Related Questions