开发者

How to call a popup window in C#

I have webform1,webform2. I have a submit button in webform1.When the submit is clicked,开发者_开发技巧 it has to perform some function then based on the result i have to show different data (let say accept/decline images) in the webform2(POPUP). When this popup is displayed user should not be allowed to make any changes to webform1.

Let me know how to achieve this.

Thanks in advance


Just add the following code in the pageLoad method:

YourButtonID.Attributes.Add("onclick", "window.open('WebForm2.aspx',null,'left=400, top=100, height=350, width= 580, status=no, resizable= no, scrollbars= yes, toolbar= no,location= no, menubar= no');");

EDIT: Place the code in the Button_Clicked event handler instead in pageLoad...works in both ways, but it is better solution...


Aren't you asking for a "modal" popup?

You should try with ShowModalDialog method.


Alternatively you can try AJAX Modal Popup... Click Here for the sample...


To achieve this in my web application I used raw HTML+CSS+Javascript.

Basically what you need is a top level div added to body with 100% size. Then another div with margin:auto, sized the way you want.. You could make that earlier div transparent or semi transparent using CSS.

This will only work on the good browsers ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜