1

I am working with asp.net controls(textboxes), but only for the calendar control I am using jquery code(because it has a good UI) that has html <input type="text" id="datepicker">

Now, I want to insert the value of this input field into the database. With asp.net controls,it is easily possible using cmd.Parameters.AddWithValue("@MemberId", txtMemberId.Text); But I am stuck with the html input control, Please help me out. Thank you.

1
  • if you add runat = server you can call the HTML control. I have done this before. Example <img src = "myimage.png name = "mypicture" runat = "server"> Commented Jul 25, 2014 at 17:49

2 Answers 2

2

You can use runat = "server" for your HTML control or you can alternatively use a hiddenfield to store the selected data and this hidden field value can be accessed in your code. You'll have to assign the value of datepicker.text to the hidden field through javascript.

You can access the hidden field value in code as hdnDate.Value

The link here will help you understand when to use runat="server" on normal HTML controls.

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

Comments

1

You should be able to access the control by doing this:

<input type="text" id="datepicker" runat = "server">

3 Comments

Thank you, but then how should I insert this value into the database? should I use the id and write insert into table values('"+datepicker.text+"') where datepicker is the id of the input control?
I would assume you use datePicker.value. Once you do runat = Server it will show up in intellesense.
but now I have another problem, when I combine jquery code with twitter bootstrap the calendar does not show up.How should I solve this.Please help

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.