什么是C#WebForm的JOptionPane输入等价物 [英] What is the JOptionPane input equivalent for C# WebForm

查看:118
本文介绍了什么是C#WebForm的JOptionPane输入等价物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我过去只使用过Java而且我还习惯使用C#所以我需要知道是否可以通过JoptionPane等效方式请求和接受用户输入。

请记住,我正在使用WebForm而不是普通的表格



之前我使用过ScriptManager.RegisterStartupScript来显示消息但这次我需要也接受输入。



感谢所有帮助。

I've used java only in the past and I'm still getting used to C# so I need to know if it's possible to ask for and accept user input by means of a JoptionPane equivalent.
Bear in mind, I'm working with a WebForm and not a normal Form

I've used ScriptManager.RegisterStartupScript before to display a message but this time I need to also accept input.

All help is appreciated.

推荐答案

它几乎可以是任何东西。首先,将UI概念从Swing直接转移到WebForms并不是一个好主意,因为技术的基础知识非常不同。由于这个原因,没有确切的输入等价物,也不可能。实际上要做什么取决于你想要达到的目标。与相似的JOptionPane 不能成为真正的目标。真正的目标应该以语义敏感的形式表达。



首先 JOptionPane 用于弹出一些对话。弹出一个网页是个坏主意。这样的行为是侵入性的,对用户来说不方便,并且会被许多浏览器插件阻止。同时,如果你真的需要一些模态行为,你可以在同一页面上模仿它,这应该可以很好地工作。一种方法是使用jQuery UI对话框插件: https://jqueryui.com/dialog [ ^ ]。



另外,你可以找到很多第三方jQuery插件统称为模态弹出窗口,具有不同的视觉效果和样式,例如过渡,尤其是页面其余部分的变暗。请参阅:

http://bfy.tw/AJH [ ^ ]。



如果你需要学习jQuery(强烈推荐) ),请参阅:

http://en.wikipedia.org/wiki/JQuery

http://jquery.com

http://learn.jquery.com

http://learn.jquery.com/using-jquery-core

http://learn.jquery.com/about-jquery/how-jquery-works (从这里开始)。



但是,更重要的是,重新考虑整个想法。您是否真的需要以模态方式输入数据,以向用户提供模态请求?如何使用更强大的模型,用户可以随时编辑数据的某些变化?它可能需要更多的工作,但可以提供更多的可用性。输入参数的区域可以是div或某些扩展控件 http://bfy.tw / 1ccA [ ^ ])。



正如我所说,它几乎可以是任何东西。



-SA
It can be nearly anything. First of all, it's not a good idea to directly transfer the UI ideas from Swing to WebForms, where the basics of technology are very different. By this reason, there is no exact "input equivalent", and cannot be. What to do practically, depends on what exactly you want to achieve. Similarity to JOptionPane cannot be a real goal. The real goal should be formulated in semantically sensitive form.

First of all JOptionPane is used to pop-up some dialog. It's a bad idea to pop-up a web page. Such action is intrusive, inconvenient for the users, and will be blocked by many through some browser plug-in. At the same time, if you really need some modal behavior, you can mimic it on the same page, which should work perfectly fine. One way to do it is the jQuery UI dialog plug-in: https://jqueryui.com/dialog[^].

Also, you can find many 3rd-party jQuery plugin collectively known as "modal popup", featuring different visual effects and styles, such as transitions, and, notably, dimming of the rest of the page. Please see:
http://bfy.tw/AJH[^].

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery,
http://jquery.com,
http://learn.jquery.com,
http://learn.jquery.com/using-jquery-core,
http://learn.jquery.com/about-jquery/how-jquery-works (start from here).

But, more importantly, re-thing the whole idea. Do you really need to input data in a modal manner, to give a modal request to a user? How about a way more powerful model where the user can edit some changes in data at any moment of time? It may need more work, but can provide a lot more usability. The area for entering the parameters can be something line a "div", or some extender control (http://bfy.tw/1ccA[^]).

As I say, it can be nearly anything.

—SA

这篇关于什么是C#WebForm的JOptionPane输入等价物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆