How to populate data in scheduler on basis of dropdown selection on top of page ?
Hi Team,
Could you please give me syntax for schedular databind on basis of dropdown selection on top of schedular page ?
<SfDropDownList TValue="string" Placeholder="Select"
TItem="RepaireType"
DataSource="@LocalRepaireData">
<DropDownListFieldSettings Text="Text" Value="Text"></DropDownListFieldSettings>
<DropDownListEvents TValue="string" TItem="RepaireType" ValueChange="onValueChange">
</DropDownListEvents>
</SfDropDownList>
--------------------------------------------------------------------
private void onValueChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, RepaireType> args)
{
try
{
// Schedulectrl.GetEventDetails= GetScheduleData().Where(m => m.Subject == args.Value);
// what would the syntax for schedular data binding
}
catch (Exception ex)
{
// Logger.LogInformation(ex.StackTrace);
}
}
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
NR
Nevitha Ravi
Syncfusion Team
March 15, 2021 10:52 AM UTC
Hi chandradev,
Greetings from Syncfusion Support.
You can directly assign the data to the variable which is assigned to scheduler DataSource property to bind the data dynamically, please refer to the following sample for the same.
|
<SfDropDownList TValue="string" Placeholder="Select"
TItem="string"
DataSource="@LocalData">
<DropDownListFieldSettings Text="Text" Value="Text"></DropDownListFieldSettings>
<DropDownListEvents TValue="string" TItem="string" ValueChange="onValueChange">
</DropDownListEvents>
</SfDropDownList>
<SfSchedule TValue="AppointmentData" Height="550px" AllowDragAndDrop="false" @bind-SelectedDate="@CurrentDate">
<ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings>
</SfSchedule>
@code{
DateTime CurrentDate = new DateTime(2020, 1, 31);
private string[] LocalData = new string[] { "Meeting", "Test", "Conference", "Vacation" };
private void onValueChange(ChangeEventArgs<string, string> args)
{
DataSource = GetScheduleData().Where(x => x.Subject == args.Value).ToList();
}
List<AppointmentData> DataSource = GetScheduleData();
static List<AppointmentData> GetScheduleData()
{
List<AppointmentData> dataSource = new List<AppointmentData>
{
new AppointmentData{ Id = 1, Subject = "Meeting", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0)},
new AppointmentData{ Id = 2, Subject = "Test", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0)},
new AppointmentData{ Id = 3, Subject = "Conference", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0)},
new AppointmentData{ Id = 4, Subject = "Vacation", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0)},
};
return dataSource;
} |
Please try the above sample and get back to us if you need any further assistance.
Regards,
Nevitha
Marked as answer
CH
chandradev
March 15, 2021 11:52 AM UTC
Thanks for sending exact code snippet
NR
Nevitha Ravi
Syncfusion Team
March 16, 2021 04:33 AM UTC
Hi chandradev,
You are most welcome..! We are glad that our provided solution helps you, please get back to us for further assistance.
Regards,
Nevitha
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
CH chandradev
- Mar 14, 2021 03:39 PM UTC
- Mar 16, 2021 04:33 AM UTC