Hi,
How can I postback when I use the keyboard to change the value in the WebDatePicker? I know how to accomplish this by selecting from the calendar.
Thank you,
Trent
Hi Trent,
You may enable autopostback on enter key. Similar way can be triggered a postback on lost focus (value change). To trigger postback on other keys or events, application may process corresponding client side events (like KeyUp), check event/keyCode, check current value in editor (if it is valid and complete), etc, and call __doPostBack(sender.get_uniqueID(), '') or use similar statements.
Example for autopostback:
<ig:WebDatePicker ID="WebDatePicker1" runat="server"> <AutoPostBackFlags EnterKeyDown="On" /></ig:WebDatePicker>
Hi Viktor,
When I added the AutoPostBackFlags-EnterKeyDown="On", the value change from selecting the date on the calendar does not trigger the postback.
Hello tnguen13,
What I can suggest in for achieveing your requirement is turn on the WebDatePicke`s AutopostBackFlag of Value changed as well as Enter Key Down as such:
<ig:WebDatePicker ID="WebDatePicker1" runat="server"> <AutoPostBackFlags EnterKeyDown="On" ValueChanged="On" /> </ig:WebDatePicker>
<ig:WebDatePicker ID="WebDatePicker1" runat="server">
<AutoPostBackFlags EnterKeyDown="On" ValueChanged="On" />
</ig:WebDatePicker>
I am also attaching a small sample project I used to test this for your reference. My test was performed with version 12.20122.2075 of NetAdvantage. If the project does not work correctly on you side or it is not an accurate demonstration of what are you trying to do please feel free to modify it and send it back, or send a small sample project of your own where the issue is reproducible. Also some additional information would be highly appreciated.
Is the sample project attached somewhere?
Thanks,
Hello tnguyen13,
It seems that the system has rejected my attachment. I am attaching it again for your reference.
Hope this helps.Please let me know if you have any questions.
Hello Trent,
Thank you for your feedback. I am glad that you managed to resolve the issue.
We value your input, and our philosophy is to enhance our toolset based on customer feedback.
Please let me know if I can be of any further assistance.
Hi Vasya,
I managed to get it working by adding the Javascript. However, I don't feel that is the right solution. I used Infragistics control because it is suppose to write all that code for me. Why should I enable something to postback and then have to write the Javascript code to postback.
I was wondering did you have a chance to try my suggestion? Please feel free to contact me if you have any additional questions regarding this matter.
What I can suggest for achieving your requirement is handle WebDatePicker`s KeyDown event which is fired even when the DateTimePicker is on focus. In the event current text being entered is accessible via sender`s get_text() method as such: sender.get_text(); . Please note that string returned from this method contains everything visible in the input textbox of the DatePicker, including the slashes used to separate the date ("_2/__/____"). What I can suggest is take this string, split it by the slash("/") symbol and check whether the input is a valid date. If the input is a valid date a CallBackManager object for the WebDatePicker control may be executed to cause a PostBack as such:
var callbackObject = sender._callbackManager.createCallbackObject(); sender._callbackManager.execute(callbackObject);
var callbackObject = sender._callbackManager.createCallbackObject();
sender._callbackManager.execute(callbackObject);
I hope this helps.
Let me know if you have any questions.
There is no AutoPostBackFlag, which would trigger postback when calendar is closed. Application has to process client events and trigger postback.