Saturday, February 19, 2011

popup occur by clicking button control in asp.net

we can popup using javascript in .aspx file or aspx.cs file
in aspx file
<script language="javascript">
function pop(url)
{window.open("url");}
</script>
<asp:Button id="Button1" runat="server" Text="popup" onclick="pop('default.aspx')"/>// default.aspx page will pop up when we click popup button.

or we can also write        onclick="javascript:window.open('default.aspx')"/>;

In .cs file
we can write
Button1.attributes.add("onclick","window.open('default.aspx')");

No comments:

Post a Comment