Closed webdevguyrg closed 8 years ago
Try a __doPostBack() from our onChange callback.
Thanks!
I tried this, but it didn't work. I put a breakpoint on both page_load and cmdRun_Click. Any idea why?
onChange: function () {
__doPostBack('#<%= cmdRun.ClientID%>', '')
}
The button is a standard asp.net button....
<asp:Button ID="cmdRun" runat="server" Text="Run" />
Any JS errors/warnings? Is the __doPostBack javascript function defined? Maybe http://stackoverflow.com/questions/1305954/asp-net-postback-with-javascript helps.
Yes. In fact, I even put an ALERT which never seems to be invoked...
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
$("#e7").daterangepicker({
onOpen: function () {
alert("onOpen");
},
onClose: function () {
alert("onClose");
__doPostBack($('#<%= cmdRun.ClientID%>').attr('name'), '');
},
onChange: function () {
alert("onChange");
__doPostBack($('#<%= cmdRun.ClientID%>').attr('name'), '');
}
});
I guess your button's id is not e7
, but <%= cmdRun.ClientID%>
I'm using this date range picker in an asp.net website. On my aspx page I have the date picker and an asp.net label. When the user selects the date range how can I automatically (similar to text_changed event) run my vb.net server-side code which, among other things, puts a message in the label based on their selection, such as "You selected the date range: 1/1/2015 thru 2/3/2015"? Thanks!