This is a migrated thread and some comments may be shown as answers.

RadDatePicker onselecteddatechanged event firing only for the first time

1 Answer 855 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
nirmal
Top achievements
Rank 1
nirmal asked on 18 Aug 2009, 06:40 AM
Hi,

I am trying to achieve the following functionality. 
1. Display only the calendar pop up image and make the textbox associated with it invisible. For this I am using RadDatePicker control  and managed to hide the textbox and show only the pop up.
2. Whenever a date is selected on the pop up, I want to add the selected date item to a drop down on the server side. The Dropdown is an asp.net control.
3. I am using the onselecteddatechanged event of the RadDatePicker with its AutoPostBack set to true. For trial runs, I am writing the Old date and New date in a textBox.
      My problem is that when the date is selected on the calendar pop up for the first time, a Postback occurs and the text in the textbox is written with Old Date as null and new date as selected from the pop up. However on subsequent attempts when i select a different date from the calendar pop up there is nothing happening. No postback takes place and the textbox text remains same. 
Reuqest you to kindly help me with this problem

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 18 Aug 2009, 07:27 AM
Hi Nirmal,

I tried this on my end and the SelectedDateChanged event is getting fired each and every time a date selection is made. Here is the sample code which I tried on my end.

ASPX:
 
<telerik:RadDatePicker ID="RadDatePicker1" DateInput-Visible="true"  AutoPostBack="true" runat="server" OnSelectedDateChanged="RadDatePicker1_SelectedDateChanged" > 
             <DateInput runat="server" style="display: none;"></DateInput> 
            </telerik:RadDatePicker> 

CS:
 
protected void RadDatePicker1_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) 
    { 
        TextBox1.Text = RadDatePicker1.SelectedDate.ToString(); 
    } 

Thanks
Shinu

Tags
General Discussions
Asked by
nirmal
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or