Click here to Skip to main content
16,014,669 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello sir.

I have two pages. a.aspx, b.aspx. There are 4 buttons in a.aspx, when we click button1 or button2 or button3 or button4 new window should be opened. and there is some different functionality for each button.
my doubt is how bind each button to window.open method.

If any body know please help me.

My code is below:

a.aspx
------

XML
<script type="text/javascript">
        function openwindow() {
            window.open("AllPageDetails.aspx", "mywindow", "menubar=1,resizable=1,width=350,height=250");
        }

    </script>

XML
<asp:ImageButton ID="ImgBtnCategory" runat="server" OnClientClick="openwindow()" PostBackUrl ="~/AllPageDetails.aspx?ImgBtnCategory=Category"/>


b.aspx
------

C#
if (Request.QueryString["ImgBtnCategory"] == "one")
            {
                LblId.Text = "Actor Id";
                LblName.Text = "Actor Name";
                TxtExtra.Visible = false;
            }
Posted
Updated 9-Nov-10 3:30am
v2
Comments
Henry Minute 9-Nov-10 9:31am    
You have already asked this question. Please delete the one that you do not want.

1 solution

I would disable the postbackurl:
PostBackUrl ="JavaScript.Void(1);"

then change javascript function:

XML
<script type="text/javascript">
       function openwindow(id) {
       window.open("AllPageDetails.aspx?id=" + id, "mywindow", "menubar=1,resizable=1,width=350,height=250");
        }
    </script>


And pass this id from your OnClientClick:
C#
OnClientClick="openwindow(1);" 


After that you will handle this is on the server side to display the proper result.
 
Share this answer
 

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