1

I am working on an asp.net page where I am saving user input into my database using TextBox e.g ***<asp:TextBox ID="code" runat="server" Width="155px"></asp:TextBox>*** in this case I'm getting the ID of the TextBox as "code" so i can capture the values from that TextBox. Now i have a jQuery texbox <input type="text" id="date" required="required"/> where "date" is jQuery function ID. Which attribute or ID should i use to capture the user input and save them into my database using this <input type="text" id="date" required="required"/> textbox..?

2
  • your question is not clear. Please provide your code and phrase it properly Commented Jul 10, 2017 at 13:38
  • this is vague and uses confusing terminology. Post the relevant code please. Commented Jul 10, 2017 at 13:39

3 Answers 3

1

you can change your plain textbox to asp textbox

<asp:TextBox Id="date" runat="server" required="required" />

if not than you can get values of plain Html elements in code behind.

  1. Write a function to set the value of "date" textbox to a hidden field
  2. Than capture the value of hiddenfield in your code behind

Hope this helps

Sign up to request clarification or add additional context in comments.

Comments

1

Why not simply turn that field into a asp.net control as well?

Would be:

<asp:TextBox Id="date" runat="server" required="required" />

It will be rendered as a input type="text" to the browser anyway and should work just fine.

In order to find the control (since ASP.NET sometimes have the odd interest in prefixing controls) you can just use $find in your script. Or, as someone pointed out, use class selectors (i.e assign a CssClass attribute to your TextBox) and use that as selector in your jQuery code.

That way the date value will be available both to server side operations and client side.

1 Comment

@Inno if an answer worked please remember to mark it as the accepted answer. If more than one worked, pick the best quality answer.
0

you can use Asp.Net textbox as jquery datepicker, just use class selector to convert into jquery ui date picker

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.