Just use a form and take the value from there and use it in your server side code like a variable you will get from a form. Give the input field a name and use it to Request.Form["name"] and extract the values.
Please "Marks As Answer" if any answer helped you out!
~~! FIREWALL !~~
Marked as answer by triskac on Nov 29, 2012 04:18 PM
triskac
Member
15 Points
52 Posts
How to add value from popup calendar to variable?
Nov 29, 2012 01:34 PM|LINK
Hello,
i have found code for popup calendar. The code is working fine, but i don't know how to add selected day to variable.
I want to use the date which i selected, later in select. Do you have any ideas how to do it.
Thanks
msmk
Participant
776 Points
158 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 02:04 PM|LINK
I think this might answer your question:
http://stackoverflow.com/questions/1624660/get-selected-date-in-jqueryui-datepicker-inline-mode
triskac
Member
15 Points
52 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 02:26 PM|LINK
msmk thank you for your reply, but can you tell me please how i call the value?
when i try this it is not working
thanks
msmk
Participant
776 Points
158 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 02:41 PM|LINK
Where are you trying to call the value? what are you trying to do with it?
triskac
Member
15 Points
52 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 02:45 PM|LINK
I would like to see, what date i chose, how to do it?
Thanks
msmk
Participant
776 Points
158 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 02:53 PM|LINK
ICreate a label or textbox and try setting the text property to dateAsString
var dateAsString = dateText; $('#txtDate').val(dateAsString);triskac
Member
15 Points
52 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 03:19 PM|LINK
msmk,
thanks for trying to help me.
I tried it, but i it is not working. I didn't work with javascript, it is new for me, so if you know solution, please write me whole code.
this is not working
thanks
msmk
Participant
776 Points
158 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 03:28 PM|LINK
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>jQuery UI Datepicker - Default functionality</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script> $(function() { $("#datepicker").datepicker({ onSelect: function(dateText, inst) { var dateAsString = dateText; //the first parameter of this function $("dateAsString").val(dateAsString); var dateAsObject = $(this).datepicker( 'getDate' ); //the getDate method } }); }) </script> </head> <body> <p>Date: <input type="text" id="datepicker" /></p> <label for="dateAsString" id="label1">You Chose</label> <input id="dateAsString" type="date" /> </body> </html>Try this. I assigned that value of the label in the onSelect method of the datePicker - $("dateAsString").val(dateAsString);
triskac
Member
15 Points
52 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 03:39 PM|LINK
it doesn't work, label is empty
no value is there
Afzaal.Ahmad...
Contributor
2661 Points
1040 Posts
Re: How to add value from popup calendar to variable?
Nov 29, 2012 04:03 PM|LINK
Just use a form and take the value from there and use it in your server side code like a variable you will get from a form. Give the input field a name and use it to Request.Form["name"] and extract the values.
~~! FIREWALL !~~