#102274
YavorDashev
Member

Hi Maserati,
If you want to have this functionality but with Blazor/C# I have prepeared another code snippet for you to showcase you how to achieve this.
In your razor file:

	<style>
			.smart-gantt-chart.disabled-selection .smart-table-select-row{
				pointer-events: none;
			}
			.smart-gantt-chart.disabled-selection .smart-table-select-row.selected {
				pointer-events: initial;
			}
	</style>
	<GanttChart class="@ganttSelectionClass"  @ref="ganttChart" OnChange="@ChangedHandler" DataSource="Data" OnProgressChangeEnd ="@ProgressChangedHandler"  TaskColumns="taskColumns" DurationUnit="Duration.Hour"></GanttChart>
@code {
	GanttChart ganttChart;
 	string ganttSelectionClass= "";
	public async void ChangedHandler(Event args)
	{
		IEnumerable<object> SelectedTasks = await ganttChart.GetSelectedTasks();
		List<object> tasksList = SelectedTasks.ToList();
		int maxCount = 1;
		if (tasksList.Count() >= maxCount)
		{
			ganttSelectionClass= "disabled-selection";
		}
		else
		{
			ganttSelectionClass= "";
		}
	}

Let me know what you think!
Please, do not hesitate to contact us if you have any additional questions.
Best regards,
Yavor Dashev
Smart UI Team
https://www.htmlelements.com/