How to capture click event for ButtonGroupButton

When I try to define an @onclick handler for a ButtonGroupButton I get a runtime error:

 Unhandled exception rendering component: Object of type 'Syncfusion.Blazor.SplitButtons.ButtonGroupButton' does not have a property matching the name 'onclick'.

How can I know when a ButtonGroupButton is clicked? 

4 Replies 1 reply marked as answer

GK Gayathri KarunaiAnandam Syncfusion Team March 26, 2021 04:51 AM UTC

Hi Jim, 
  
Thanks for contacting Syncfusion Support. 
  
We have checked your query. We have already considered this as an improvement, and it will be available in our 2021 Volume 1 release, which will be scheduled on end of March 2021. We appreciate your patience until then. You can also track the status of this improvement by using below feedback portal link. 
  
  
However, we can bind click event in ButtonGroup Button by using below code snippet. 
  
  
@using Syncfusion.Blazor.SplitButtons 
<SfButtonGroup> 
    <SfButton @onclick="@((MouseEventArgs args) =>  OnClickHandler(args, "Left"))">Left</SfButton> 
    <SfButton @onclick="@((MouseEventArgs args) =>  OnClickHandler(args, "Center"))">Center</SfButton> 
    <SfButton @onclick="@((MouseEventArgs args) =>  OnClickHandler(args, "Right"))">Right</SfButton> 
</SfButtonGroup> 
<br /> 
<br /> 
<textarea value="Item Clicked: @content"></textarea> 
@code{ 
    private string content; 
    private void OnClickHandler(MouseEventArgs args, string text) { 
        content = text; 
    } 
} 
  
  
For your reference we have prepared sample here. 
  
  
Please let us know if you have any concern on this. 
  
Regards, 
Gayathri  



GK Gayathri KarunaiAnandam Syncfusion Team April 5, 2021 04:21 PM UTC

Hi Jim, 

We are glad to announce that our Essential Studio 2021 Volume 1 release v19.1.0.54 is rolled out and is available for download under the following link. 

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards,           
Gayathri K 


Marked as answer

CM Chas Meier replied to Gayathri KarunaiAnandam January 5, 2024 08:21 PM UTC

This technique does not seem to work any longer.  generates errors in the generated code.  



KV Keerthikaran Venkatachalam Syncfusion Team January 8, 2024 03:22 PM UTC

Hi Chas,


We have checked your reported query and attempted to replicate the issue on our end, but were unable to do so. We have prepared the sample based on your provided details. I have attached the sample for reference.


For further validation, could you please share the issue's replicable working sample or replicate the issue in our sample with replication steps and a video demonstration? and which package version you are using in your project. Based on that, we will check and provide you with a better solution quickly.


Please let us know if you need any further assistance on this.


Regards,

KeerthiKaran K V


Attachment: ButtonSample_aa0242be.zip

Loader.
Up arrow icon