简体   繁体   English

[ASP.Net/VB.Net]从HTML输入文本块中检索信息

[英][ASP.Net/VB.Net]Retrieving info from a HTML input text block

I have 2 HTML blocks, with JQuery DateTimePicker. 我有2个HTML块,带有JQuery DateTimePicker。 Now after the date is picked (When you click the input box, the datepicker appears, then you click the date, the date appears in the input box, and when you click away somewhere, the datepicker dissapears. Now I need to retrieve that info with VB.Net and ASP.Net. Thank you. 现在,选择日期之后(单击输入框时,将显示日期选择器,然后单击日期,日期将显示在输入框中,而当您单击某个位置时,日期选择器将消失。现在,我需要检索该信息使用VB.Net和ASP.Net。谢谢。


I just changed the HTML input box to Asp.net Textbox Then added the OnTextChanged function call when the text is changed, and called a function that stores that date into my class. 我只是将HTML输入框更改为Asp.net文本框,然后在更改文本时添加了OnTextChanged函数调用,并调用了将该日期存储到我的类中的函数。 As such: 因此:

Start date:
<asp:TextBox name="startDate" ID="startDate" OnTextChanged="startDate_TextChanged" runat="server" AutoPostBack="True"></asp:TextBox>

I tried to go with asp:TextBox before, but for some reason JQuery didn't work on it. 我以前尝试过使用asp:TextBox,但是由于某种原因,JQuery无法对其进行处理。

If you need to access the values of the input box on the client side, then you can use jquery as below: 如果需要访问客户端输入框的值,则可以使用jquery,如下所示:

         $("#Your_HTML_InputBox_ID").val();

On the server side, you can access the values from the FormCollection available on the page you post this form to. 在服务器端,您可以从发布此表单的页面上的FormCollection中访问值。

Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM