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

Selected date as parameter for ObjectDataSource

3 Answers 66 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Lars Meyer
Top achievements
Rank 2
Lars Meyer asked on 11 Sep 2009, 11:51 AM
Is it possible to use the SelectedDate in RadCalendar as a parameter for  an ObjectDataSource? I wish to filter the records shown on my page, based on the date the user picks in the calendar, or is there another way to do this? I can't seem to find any examples on this...

3 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 16 Sep 2009, 05:04 PM
Hello Lars,

Attached is a sample project demonstrating how to achieve the desired functionality. After choosing a date from the calendar the grid will be rebound with data based on the selected date.

I hope this helps.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Lars Meyer
Top achievements
Rank 2
answered on 16 Sep 2009, 08:07 PM
Thanks for the reply.

I need to set the select parameters for the ObjectDataSource programmatically, but when I try this, the grid is not updated when I hit a date in the Calendar.

protected void Select(object sender, ObjectDataSourceSelectingEventArgs e) 
    { 
        e.InputParameters["selectedDate"] = RadCalendar1.SelectedDate; 
    } 
I commented out the <SelectParameters> section in the .aspx page.

Is this not possible?


0
Martin
Telerik team
answered on 18 Sep 2009, 12:15 PM
Hello Lars,

Declaring your parameters programmatically would require to rebind the grid manually every time RadCalendar1.SelectionChanged event fires:

protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e) 
    { 
        RadGrid1.Rebind(); 
    } 

I hope this helps.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Calendar
Asked by
Lars Meyer
Top achievements
Rank 2
Answers by
Martin
Telerik team
Lars Meyer
Top achievements
Rank 2
Share this question
or