Select theme:

Material 3

Stored procedure default parameter value (Blazor)link

This guide demonstrates how to set stored procedure default parameter value.

Step by steplink

1. Create new application with .NET server-side project and add new MSSQL data-source connected to Northwind database and check stored procedures. image

Stored procedures execution can be customized using partial classes and methods.

image

2. Create NorthwindService partial class, provide default value for CustomerID parameter for OnCustOrderHistsDefaultParams method and filter the result. Set default value for parameters

public partial class NorthwindService
{
    partial void OnCustOrderHistsDefaultParams(ref string CustomerID)
    {
        CustomerID = "AROUT";
    }

    partial void OnCustOrderHistsInvoke(ref IQueryable<CustOrderHist> items)
    {
        items = items.Where(i => i.Total > 25);
    }
}

image

3. Invoke getCustOrderHists on button click without parameter and bind DataGrid to result. image

4. Run the application image

In this article —
© 2016-2025 Radzen Ltd. All Rights Reserved.
Designed and developed with ❤️ in Radzen Blazor Studio.

Select theme:

Material 3