在asp.net C#的输入框 [英] input box in asp.net c#
问题描述
我需要在我的C#网站创建一个简单的输入框。
它应该弹出,当我在code一样,把它叫做
I need to create a simple input box on my website in C#. It should pop up, when i call it in the code like that
String input = InputBox("Name the file");
然后我需要使用字符串的用户在code后进入
在.NET应用程序,它是pretty容易完成,但我怎么能使其在一个Web应用程序的工作?我认为应该是可能的AJAX,但它似乎pretty复杂,这样的(貌似)件小事。
是否有任何形式的库或框架,我可以利用这个,对吗?
and then I need the use string the users enters later in the code In a .net application, it is pretty easy to accomplish, but how can i make it work in a web application? I think it should be possible with ajax, but it seems pretty complicated for such a (seemingly) trivial thing. Is there any kind of library or framework, that I can use for this right away?
在此先感谢
推荐答案
这听起来像你对我正在寻找的行为是得到一个弹出窗口的文本框供用户输入一个值,然后单击确定。是这样吗?
It sounds to me like the behavior you are looking for is to get a popup window with a text box for the user to enter a value and click ok. Is that right?
你说得很对,这是一个Web应用程序更加复杂。在Windows应用程序,只要您运行的C#code,无论发生什么事情,发生在那一刻。这是pretty简单。然而,在Web应用程序中,所有的C#的运行前的页面在浏览器中呈现,甚至。因此,C#在Web窗体不能的真正的弹出一个窗口。
You're right in saying that it is more complicated with a web app. In a windows app, whenever you run the C# code, whatever happens, happens at that moment. It's pretty straightforward. However, in a web app, all of the C# runs before the page is even rendered in the browser. Therefore, C# in web forms can't really pop up a window.
为了得到一个弹出,你需要做的是使用JavaScript。弹出式内的文本框应该是< ASP:文本框>
控制。您可以使用 Ajax控件工具包如果youre最舒服的.NET控件。如果您选择使用jQuery comforatble,你应该看看 jQuery UI的。
In order to get a popup, you'll need to do that with JavaScript. The textbox inside the popup should be an <asp:Textbox>
control. You can use the Ajax Control Toolkit if youre most comfortable with .NET controls. If youre comforatble with jQuery, you should check out jQuery UI.
这篇关于在asp.net C#的输入框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!