Hi
I have 2 webdate choosers in a page namely start date , end date. When the first time page loads start date highlights current date, month dropdown shows current month and year dropdown shows current year. First I changed the month to "March" and year to "2007". Then I have a button reset, there I set the value to null in server side as given below.
wbchStart.Value = null;
Using javscript in another page
Now the start date month, year dropdowns shows the value selected previously(March,2007). Same case for end date also. But I want to reset the month, year dropdowns to what it is displayed(September,2009) while pageload. I want the solution to reset in javascript also.
How can I do this? I am using c#. I have posted the code below. Let me know if you need any more information. I need immediate help in this regard. Thanks in advance.
<igsch:WebDateChooser Width="90px" ID="wbchStart" Section508Compliant ="true" runat="server" NullDateLabel="MM/DD/YYYY" CssClass ="date"> <ClientSideEvents InitializeDateChooser="InitProjectStartDateChooser" /></igsch:WebDateChooser >
function ResetDate() {
oStartTimeGenDateCt4.setValue(
null);
}
Hi Slidhar,
The setValue(null) should reset date in WebDateChooser on client. You may call that at any time: on init dateChooser, onload body and on any other event. Below is example:
<script type="text/javascript">function resetDateChooser(oDateChooser){ oDateChooser.setValue(null);}function resetValue(){ var dc = igdrp_getComboById('<%=WebDateChooser1.ClientID%>'); if(dc) resetDateChooser(dc);}</script><igsch:WebDateChooser ID="WebDateChooser1" runat="server" Value="2000-10-10"> <ClientSideEvents InitializeDateChooser="resetDateChooser"> </ClientSideEvents></igsch:WebDateChooser><input type="button" onclick="resetValue()" value="reset" />
I attached the screenshot with explanation for your reference.
Thanks.
Hi Viltor,
This solution also not working. I attached the sample site that I worked to you. I don't know whether you understand my question. I am telling it again.
"When the first time page loads datechooser highlights current date, month dropdown shows current month and year dropdown shows current year. Note: I set the nulldatelable as "MM/DD/YYYY"
I changed the month to "March" and year to "2007" and select the date as 3. Then I have a button reset using your code. The value set as null in code. Now please check the dropdowns it will show "March", "2007" (ie) previous selection. But I want to show as current month and current year in dropdowns as like page loads. I need to reset the dropdowns also to current date"
You can tell set current date while resetting but after reset it shows current date(Inside textbox) not MM/DD/YYYY. But I want to use as in pageloads while resetting.
Also tell me solution in c# code(in server side) for the same scenario. Use server side button reset by replacing input client button.
Thanks and regards
Sridhar