Forum Moderators: open

Message Too Old, No Replies

Jquery newbie question

         

dertyfern

4:32 pm on Jul 17, 2010 (gmt 0)

10+ Year Member



I'm totally new to jquery and am banging my head on the wall trying to figure out how to pass the selected date from a datepicker to codebehind on .net #c.

Datepicker aspx code is:
<input id="datepicker" type="text" />

If I add runat="server" the datepicker simply doesn't show up when previewing the aspx page.

I must be totally off on this.

Thanks for any help.

dertyfern

7:57 am on Jul 18, 2010 (gmt 0)

10+ Year Member



Can anyone then recommend a resources on how to go about this or steer me in the right direction?

enigma1

11:10 am on Jul 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want to update the server end you should pass it using ajax. For example:

var some_script = {
ajaxRequest: function (options){
var result = $.ajax({
url: options.url,
type: options.type || 'POST',
cache: options.cache || false,
dataType: options.dataType || 'html',
async: options.async || false,
contentType: options.contentType || 'application/x-www-form-urlencoded; charset=utf-8',
data: options.data || false,
success: options.success,
error: options.error,
complete: options.complete
});
},
html_init_: function() {
// Handler for date change here
$('#datepicker').change(function() {
some_script.ajaxRequest({
data: post_data,
url: $(this).attr('href'),
complete: function(msg){
},
success: function(msg) {
// Check result of ajax call
}

I am not familiar with asp, but the ajax call is server independent

[api.jquery.com...]

dertyfern

8:26 am on Jul 19, 2010 (gmt 0)

10+ Year Member



Thanks enigma1, I'll try to figure out how to incorporate this.