open a new window when a Button is clicked.

csharp , css Gent, Belgium
  • 12 years ago


    I want to add a functionality to the button onclick. When I click on the button, I want to open a new aspx page in a new window and pass a parameter in the querystring.

    Firstly, I tried using response.redirect

    Response.Write("<script>" +gtin.Text+ "');</script>");

    It works, it opens a new window, but something happens to my previous window after the second window loads. The css becomes not used. (at the begin the css loads, but after I click the button, it seems like css is not been used in my previous page).. Any ideas why the css file is not been active when I click on the button.

    Than, I tried,  to add an attribute to the button:

    string command = "" + gtin.Text.Trim() + "');";

    this.bt_image.Attributes.Add("onclick", command);

    and it loads only when I click the second time on the button. First time I click the button, nothing happens.. second time it opens.. Why is that?

    Please let me know what am I missing?

    Thank you




Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.” - Jon Ribbens