我如何使用新的页面弹出源创建一个弹出窗口?

编程入门 行业动态 更新时间:2024-10-27 22:31:36
本文介绍了我如何使用新的页面弹出源创建一个弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想点击一个createbutton时,弹出一个面板上,我使用的是面板和添加面板里面的一些文本框和按钮。我能够在同一页面里createbutton为present设计它使弹出面板。我可以弹出一个单独的页面,使其弹出当我点击createbutton

解决方案

戈库尔,

是的,你可以把面板在一个单独的页面,并当您单击创建按钮,它出现。这里有一个替代的(不是我的最爱,但它不依赖于任何额外的东西,除了标准JavaScript):

  • 当你点击创建按钮打开一个新的浏览器正是调整以匹配面板大小的窗口。这可以用JavaScript很容易做到如下:

      

    <  输入的onclick =JavaScript的:window.open('page.aspx','标题','状态= 0,工具栏= 0,宽度= 350,高度= 250');  类型=按钮值=创建/>

  • 在你弹出包含该面板的页面(pagecontainingPanel.aspx - 根据我的例子),你可以有code,一旦你执行一些操作来关闭该窗口。例如,如果你有一个是应该的一些数据到数据库并保存复出到父网页上的按钮,你可以这样做:

  

{

///执行服务器端进程。如果成功执行关闭此窗口。  保护无效btnSubmit_Click(对象发件人,EventArgs的发送)  如果(EverythingOK)        {           StringBuilder的cstext2 =新的StringBuilder();  cstext2.Append(<脚本类型= \\文/ JavaScript的\\>功能CloseMe(){);  cstext2.Append(window.close()的;}&下; /);  cstext2.Append(脚本>中);  cs.RegisterStartupScript(cstype,csname2,cstext2.ToString(),FALSE);        }    }

I want to pop up a panel when a "createbutton" is clicked, I am using a panel and adding some textbox and buttons inside the panel. I am able to make the pop up panel by designing it in the same page where the createbutton is present. can I make the pop up in a separate page and make it pop up when I click the createbutton

解决方案

Gokul,

Yes, you can put the panel in a separate page and make it appear when you click the create button. Here's one alternative (not my favorite but it doesn't depend on anything extra besides standard javascript):

  • When you click the "create button" open a new browser window resized exactly to match the panel's size. This can be done with javascript easily as follows:

    < input onclick="javascript:window.open('page.aspx','title','status=0,toolbar=0,width=350,height=250');" type="button" value="Create" />

  • On the page that you popped up containing the panel (pagecontainingPanel.aspx - according to my example), you can have code to close the window once you perform some action. For example, if you have a button that's supposed to save some data to the database and comeback to the parent page, you could do something like:

{

///Perform server side process. If successfully executed close this window. protected void btnSubmit_Click(object sender, EventArgs e) if(EverythingOK) { StringBuilder cstext2 = new StringBuilder(); cstext2.Append("<script type=\"text/javascript\"> function CloseMe() {"); cstext2.Append("window.close();} </"); cstext2.Append("script>"); cs.RegisterStartupScript(cstype, csname2, cstext2.ToString(), false); } }

更多推荐

我如何使用新的页面弹出源创建一个弹出窗口?

本文发布于:2023-08-06 04:35:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1310105.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出   如何使用   创建一个   弹出窗口   页面

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!