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");
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?
thanks in advance
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?
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.
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.