sp_m
sp_m

Reputation: 2707

pop up panel from codebehind on button click event

I have asp.net web application in which generate a button dynamically and I want to open pop up page or panel on that button click event.

I try the following code but it doesn't work:

protected void Test_Click(object sender, EventArgs e){

   OpenNewWindow("test.aspx");
}

public void OpenNewWindow(string url)

{
 ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("<script>window.open('{0}');</script>", url));

}

Upvotes: 0

Views: 2179

Answers (1)

Vinod
Vinod

Reputation: 4892

Try this:

Add attribute to the dynamically created buttons

Button1.Attributes.Add( "onclick", "javascript:window.open('http://www.google.com');" ); 

Upvotes: 1

Related Questions