0

how to open a pop up window in code behind(C#) without using javascript.

1
  • What are you actually trying to achieve? Commented Feb 27, 2009 at 8:43

5 Answers 5

2

Besides the fact that popups piss off a lot of people, it is not really possible to do so (if you don't consider target="_blank") without using javascript. Code written in code behind only generates client side code (which can include javascript) or executes some serverside stuff.

There might be other workarounds using flash or silverlight but I'm not sure about that. Maybe if you clarify your goal a little bit more I can give a better solution to your problem.

Sign up to request clarification or add additional context in comments.

1 Comment

So essentially, putting target="_blank" in your <a> tag will achieve it for you.
2

That is impossible because of "The code behind runs on the server; you need the popup to appear on the client machine. Therefore your code behind can't trigger a popup".

Alternatively, you can show a panel in the page as pop-up window, by seting it's z-index and giving absolute position.

Comments

1

The code behind runs on the server; you need the popup to appear on the client machine. Therefore your code behind can't trigger a popup.

Also, if you use javascript you'll probably find that the client's popup blocker prevents the new window from appearing (unless the popup happens as a direct response to a click - without posting back - in which case you can use <a target="_blank"...> if you really don't like javascript).

Comments

0

I do not think that is possible . what you can do offcourse is to open a new window with defined small width/height and all menus are stripped...

Comments

0

Just add attributes to a link button or to a button in code behind. Try this code to page load or to the button event handler.

Button1.Attributes.Add("onclick","javascript: SP.UI.ModalDialog.showModalDialog
({ url: 'PopUp.aspx', title: 'Pop Up Window', width: 600, height: 500 }); return false;");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.