小编Pav*_*sta的帖子

在 Blazor 网页中使用 @onclick 调用多个函数

当我单击按钮时,应调用 blazor 组件中的两个函数。尝试使用逗号、分号和括号。什么都行不通。

  <div class="col-md-auto"><button type="button" class="btn btn-light btn-sm" @onclick="@SearchTable"@*call two methods SearchTable and SortTable*@>Search</button></div>
Run Code Online (Sandbox Code Playgroud)

下面给出两个函数

@functions{
    public void SearchTable()
    {
        foreach (KeyValuePair<int, SearchCriteria> entry in SearchCritRefs)
        {
            entry.Value.setSearchCriteria(entry.Key);
        }
    }

    public void SortTable()
    {
        foreach (KeyValuePair<int, SortCriteria> entry in SortCritRefs)
        {
            entry.Value.setSortCriteria(entry.Key);
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core blazor

0
推荐指数
1
解决办法
853
查看次数

标签 统计

asp.net-core ×1

blazor ×1

c# ×1