Prevent button to submit form

I need to add additional buttons inside  a grid EditMode.Dialog template, for example: a button for "Shipping Address same as Customer" . The problem is when the button is clicked it submits the form, which is not what it is supposed to do. How can it be prevented ?   

<div class="form-group">
    <label class="col-sm-6">SHIPPING INFORMATION</label>
    <div class="col-sm-6">
        <SfButton  @onclick="CopyAddressFromCustomer">Same as Customer</SfButton>
    </div>
</div>


@code{

      protected void CopyAddressFromCustomer()
        {
              // code to repeat address.....
        }

}

3 Replies 1 reply marked as answer

AD Arunkumar Devendiran Syncfusion Team June 17, 2020 02:09 PM UTC

Hi Ben Junior, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported issue and we suggest you to set the Type as button to resolve your reported issue. Please refer the below code snippet. 
 
Code snippet: 
<SfButton Type="button" @onclick="CopyAddressFromCustomer">Same as Customer</SfButton> 
 
Please get back to us with more information if we misunderstood your requirement or need further assistance.  
 
Regards, 
Arunkumar D 


Marked as answer

TS Tomasz S. December 30, 2025 07:18 PM UTC

What about the latest version? 

There is currently no "Type"  property .



SM Suresh Masanam Syncfusion Team December 31, 2025 07:52 AM UTC

Hi Tomasz,


We have checked your reported query and button does not have Type property (both old and new version). If we set Type property to button like below, then we consider it has HTML Attributes and set to button component.


<SfButton Content="Add" Type="button"></SfButton> 


Image Reference:




Sample Link: https://blazorplayground.syncfusion.com/rDrSMrqsVGgFXyZY


Regards,

Suresh


Loader.
Up arrow icon