应用广泛的 Modalpopupextender
我正在尝试构建一个 modalpopupextender 以及面板和内容,并且需要使其适用于应用程序范围。我正在考虑在母版页上创建它,因此可以在所有页面上访问它,但我需要面板内的内容(我可能需要在其中添加的任何内容)从母版页外部可见和可编辑。 目前,我正在研究这个问题,但还没有弄清楚如何使其可供其他页面和类访问,因此希望获得一些帮助。
基本上,我想要的是在不久的将来更多地研究这个想法,以便使某些内容在任何 Web 应用程序上使用一致,并且完全可定制。我遇到的麻烦是“基础知识”,例如使其可供应用程序访问,允许从服务器和客户端自定义面板内的某些控件,并将从那里改进一切。
我尝试为其创建用户控件,但似乎不起作用。我不是 ASP.NET 方面的专家(只有几年的经验),更不是 Ajax 方面的专家,所以任何帮助都是值得赞赏的。 如果有人有任何疑问,请告诉我。
编辑: 我现在已经成功地在用户控件中创建了情绪,并且几乎完成了。 目前,有两个问题我无法解决:
- Firefox 3.5(企业版,不能碰这个)上发生的该死的闪烁。有时,在页面加载期间(靠近 Page_Init 或 Page_PreInit 事件,不确定),我的模式仅在发生回发时在屏幕上快速闪烁。我已经做了一些解决方法,例如设置样式显示:无,但问题仍然存在。在这件事上需要一些帮助。
- 我需要一个具有两种行为的模式,例如窗口弹出窗口。一是信息,比如只用一些按钮显示消息,二是问题。对于问题,我需要使用ConfirmButtonExtender,因此需要告诉这个确认扩展程序和模式,外部按钮(意味着不在用户控件内的按钮,这意味着它位于同一个UpdatePanel之外)作为确认扩展器和模态扩展器)将是它们的 TargetControlID。目前,我无法解决这个问题,所以我考虑在 UC 和 UpdatePanel 内创建一个按钮,该按钮始终是 TargetControlID。当弹出窗口是信息性的时,它将充当虚拟隐藏按钮(通过方法在服务器端调用信息消息),当它是一个问题时,它将收到响应。按钮要执行的方法将通过委托设置,因此当单击该方法并按下模式上的“是”按钮时,任何方法都可以运行(它还没有准备好,我不确定它是否会起作用,或者即使这是一个好主意)。 对第二个选项的任何想法都值得赞赏。
I'm trying to build a modalpopupextender, along with a panel and content, and need to make it application-wide. I am thinking about creating it on the Masterpage, so it's accessible on all pages, but I need the content inside the panel (anything that I may need to add there) to be visible and editable from outsite the masterpage.
For now, I'm working on this, but haven't figured out how to make it accessible to other pages and classes, and so would like to have some help on it.
Basically, what I want is to work more on the idea in a near future in order to make something consistent to be used on any web application, and to be fully customizable. What I'm having trouble is with "basics", like making it accessible to the application, allow customization of some controls inside the panel from both server and client sides, and will improve everything from there.
I have tried creating a user control for it, but didn't seem to work. I'm not an expert on asp.net (few years of experience), and even less on ajax, so any help is appreciated.
Please let me know if anybody have any questions.
EDIT:
I have now succeeded somehow creating the moodal within a user control and it's almost done.
At this moment, there are 2 issues I couldn't fix:
- The damn flickering that happens on Firefox 3.5 (Corporate version, can't touch this). Ocasionally during page load (Somewhere near Page_Init or Page_PreInit events, not sure), the modals I have blink quickly on the screen, only when a postback happens. I have already done some workaround, like setting style display:none, but the issue remains. Need some help on the matter.
- I need to have a modal that have 2 behaviors, like windows popups. One is information, likee only showing the message with some buttons, and the other is question. For questions, I'll need to use the ConfirmButtonExtender, and so would need to tell this confirm extender and the modal that an external button (Means a button that isn't within the user control, and by that means it's outside the same UpdatePanel as the confirm extender and modal extender) will be their TargetControlID. For now, I couldn't solve this, so I thought about creating a button inside the UC and UpdatePanel that will always be the TargetControlID. When the popup is informational, it will work as a dummy hidden button (information messages are called on server-side through methods), and when it's a question, it will receive the response. The method to be executed by the button will be set through a delegate, and therefore any method may be run when it's clicked and the Yes button on the modal is pressed (It's not ready yet, and I'm not sure it will work, or even if it's a good idea).
Any thoughts on this second option is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
母版页上的元素可以轻松地从母版页外部可见和编辑。
在此示例中,母版页有一个您想要从其他页面读取/写入的标签。
在母版页的代码文件中,为副标题创建一个属性:
然后,任何使用该母版页作为其 MasterPageFile 的页面都可以找到副标题属性并读取或写入写下来。
It's easy for elements on the masterpage to be visible and editable from outsite the masterpage.
In this example the masterpage has a label that you want to read/write from other pages
In the codefile for the masterpage, create a property for the subtitle:
Then any page that uses this masterpage as its MasterPageFile can find the subtitle property and read or write it.
我已经解决了这个问题,并创建了一个包含 modalpopup 的用户控件,用于显示自定义消息。
许多方面都是公共的,因此它允许高度定制,并且模态及其定制按钮非常有魅力。我仍然有关于闪烁的问题,但这是另一个问题。
I have solved the issue and created a user control containing the modalpopup for showing customized messages.
Many aspects are public, so it allows high customization, and the modal and it's customized buttons work like a charm. I still have a problem regarding the flickering, but it's for another question.