8 messaggi dal 26 marzo 2021
Buongiorno,
ho una tabella dove su ogni riga c'è un bottone.
Sul bottone è stato configurato l'evento click, il problema è che non lo sente, non va in errore, ma non fa nulla.
Esempio:
<table class="table table-separate table-head-custom table-checkable" id="DTgestioneaziende">
                            <thead>
                                <tr>
                                    <th>AziendaID</th>
                                    <th>Ragione sociale</th>

                                    <th>Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var azienda in aziende)
                                {
                                    <tr>
                                        <td>@azienda.AziendaID</td>
                                        <td>@azienda.AziendaDes</td>

                                        <td nowrap="nowrap">

                                            @*//modifica azienda*@
                                            <button title="Modifica Utente" @onclick="(() => OpenModal(azienda))" class="btn btn-icon btn-light-warning btn-sm mr-2">
                                                <span class="svg-icon">
                                                    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
                                                        <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                                                            <rect x="0" y="0" width="24" height="24" />
                                                            <path d="M8,17.9148182 L8,5.96685884 C8,5.56391781 8.16211443,5.17792052 8.44982609,4.89581508 L10.965708,2.42895648 C11.5426798,1.86322723 12.4640974,1.85620921 13.0496196,2.41308426 L15.5337377,4.77566479 C15.8314604,5.0588212 16,5.45170806 16,5.86258077 L16,17.9148182 C16,18.7432453 15.3284271,19.4148182 14.5,19.4148182 L9.5,19.4148182 C8.67157288,19.4148182 8,18.7432453 8,17.9148182 Z" fill="#000000" fill-rule="nonzero" transform="translate(12.000000, 10.707409) rotate(-135.000000) translate(-12.000000, -10.707409) " />
                                                            <rect fill="#000000" opacity="0.3" x="5" y="20" width="15" height="2" rx="1" />
                                                        </g>
                                                    </svg>
                                                </span>
                                            </button>
                                        </td>
                                    </tr>


                                }


                            </tbody>
                        </table>

@code {
 //openmodal
    private async Task OpenModal(Azienda azienda)
    {
        Console.WriteLine("ssss");
        //await JSRuntime.InvokeVoidAsync("OpenModal", "editAziendaModal");
    }
}

Dove sbaglio?? ho guardato anche la documentazione ufficiale ma non mi sembra scriva il codice diverso da questo
Secondo voi cosa può essere?
buongiorno!
ho provato il codice che hai inserito e a me funziona correttamente quindi mi viene questo dubbio:
puoi provare a verificare se nel file _Imports.razor sono presenti le righe seguenti?

@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop

Se nel file _imports sono presenti.. puoi farmi vedere quali @using ci sono nel file dove è presente quel componente?
a disposizione!
grazie
8 messaggi dal 26 marzo 2021
Ciao, ora mi funziona, c'era un problema su un tag html.
Però risolvendo questo problema se ne è verificato un altro.
Io utilizzo un template, si chiama keen.
Questo è il mio file _host
@page "/"
@namespace Timing.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="description" content="Timing Plan" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Timing</title>
    <base href="~/" />

    <environment include="Staging,Production">

        <link href="~/assets/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css" />
        <link href="~/assets/plugins/custom/prismjs/prismjs.bundle.css" rel="stylesheet" type="text/css" />
        <link href="~/assets/css/style.bundle.css" rel="stylesheet" />

    </environment>
    <environment include="Development">
        <link href="~/assets/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css" />
        <link href="~/assets/plugins/custom/prismjs/prismjs.bundle.css" rel="stylesheet" type="text/css" />
        <link href="~/assets/css/style.bundle.css" rel="stylesheet" type="text/css" />
        <!--begin::Layout Themes(used by all pages)-->
        <link href="~/assets/css/themes/layout/header/base/light.css" rel="stylesheet" type="text/css" />
        <link href="~/assets/css/themes/layout/header/menu/light.css" rel="stylesheet" type="text/css" />
        <link href="~/assets/css/themes/layout/brand/dark.css" rel="stylesheet" type="text/css" />
        <link href="~/assets/css/themes/layout/aside/dark.css" rel="stylesheet" type="text/css" />
        <!--end::Layout Themes-->
        <link rel="shortcut icon" href="~/assets/media/logos/favicon.ico" />
        <!--end::Datatable Themes-->
        <link href="assets/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet" type="text/css" />
        <link href="css/site.css" rel="stylesheet" />
        <link href="Timing.styles.css" rel="stylesheet" />
    </environment>




</head>
<body id="kt_body" class="quick-panel-right demo-panel-right offcanvas-right header-fixed header-mobile-fixed subheader-enabled aside-enabled aside-fixed aside-minimize-hoverable page-loading">
    @*<body id="kt_body" class="quick-panel-right demo-panel-right offcanvas-right header-fixed header-mobile-fixed subheader-enabled aside-enabled aside-fixed aside-minimize-hoverable page-loading">*@
    <component type="typeof(App)" render-mode="ServerPrerendered" />

    <div id="blazor-error-ui">
        <environment include="Staging,Production">
            An error has occurred. This application may no longer respond until reloaded.
        </environment>
        <environment include="Development">
            An unhandled exception has occurred. See browser dev tools for details.
        </environment>
        <a href="" class="reload">Reload</a>
        <a class="dismiss">&#128473;</a>
    </div>



    <environment include="Staging,Production">
        <script>var HOST_URL = "https://preview.keenthemes.com/keen/theme/tools/preview";</script>
        <script>var KTAppSettings = { "breakpoints": { "sm": 576, "md": 768, "lg": 992, "xl": 1200, "xxl": 1400 }, "colors": { "theme": { "base": { "white": "#ffffff", "primary": "#3E97FF", "secondary": "#E5EAEE", "success": "#08D1AD", "info": "#844AFF", "warning": "#F5CE01", "danger": "#FF3D60", "light": "#E4E6EF", "dark": "#181C32" }, "light": { "white": "#ffffff", "primary": "#DEEDFF", "secondary": "#EBEDF3", "success": "#D6FBF4", "info": "#6125E1", "warning": "#FFF4DE", "danger": "#FFE2E5", "light": "#F3F6F9", "dark": "#D6D6E0" }, "inverse": { "white": "#ffffff", "primary": "#ffffff", "secondary": "#3F4254", "success": "#ffffff", "info": "#ffffff", "warning": "#ffffff", "danger": "#ffffff", "light": "#464E5F", "dark": "#ffffff" } }, "gray": { "gray-100": "#F3F6F9", "gray-200": "#EBEDF3", "gray-300": "#E4E6EF", "gray-400": "#D1D3E0", "gray-500": "#B5B5C3", "gray-600": "#7E8299", "gray-700": "#5E6278", "gray-800": "#3F4254", "gray-900": "#181C32" } }, "font-family": "Poppins" };</script>
        @*<script src="~/assets/plugins/global/plugins.bundle.js"></script>
            <script src="~/assets/plugins/custom/prismjs/prismjs.bundle.js"></script>
            <script src="~/js_min/scripts.bundle.min.js"></script>
            <script src="~/assets/js/pages/widgets.js"></script>*@

    </environment>
    <environment include="Development">

        <script>var HOST_URL = "https://preview.keenthemes.com/keen/theme/tools/preview";</script>
        <script>var KTAppSettings = { "breakpoints": { "sm": 576, "md": 768, "lg": 992, "xl": 1200, "xxl": 1400 }, "colors": { "theme": { "base": { "white": "#ffffff", "primary": "#3E97FF", "secondary": "#E5EAEE", "success": "#08D1AD", "info": "#844AFF", "warning": "#F5CE01", "danger": "#FF3D60", "light": "#E4E6EF", "dark": "#181C32" }, "light": { "white": "#ffffff", "primary": "#DEEDFF", "secondary": "#EBEDF3", "success": "#D6FBF4", "info": "#6125E1", "warning": "#FFF4DE", "danger": "#FFE2E5", "light": "#F3F6F9", "dark": "#D6D6E0" }, "inverse": { "white": "#ffffff", "primary": "#ffffff", "secondary": "#3F4254", "success": "#ffffff", "info": "#ffffff", "warning": "#ffffff", "danger": "#ffffff", "light": "#464E5F", "dark": "#ffffff" } }, "gray": { "gray-100": "#F3F6F9", "gray-200": "#EBEDF3", "gray-300": "#E4E6EF", "gray-400": "#D1D3E0", "gray-500": "#B5B5C3", "gray-600": "#7E8299", "gray-700": "#5E6278", "gray-800": "#3F4254", "gray-900": "#181C32" } }, "font-family": "Poppins" };</script>

        <script src="~/assets/plugins/global/plugins.bundle.js"></script>
        <script src="~/assets/plugins/custom/prismjs/prismjs.bundle.js"></script>
        <script src="~/assets/js/scripts.bundle.js"></script>

        @*begin::Page Vendors(used by this page)*@
        <script src="assets/plugins/custom/datatables/datatables.bundle.js"></script>
        @*end::Page Vendors
        begin::Page Scripts(used by this page)*@


        <script src="~/js/utility.js"></script>
        <script src="_framework/blazor.server.js"></script>
    </environment>
  
   

</body>
<!--end::Body-->
</html>


Sul menu laterale non mi funziona nessuno evento, tipo la chiusura del menu, l'apertura di una drop nel menu, è come se gli script del template venissero richiamati prima che la pagina viene renderizzata.
Non so se mi spiego.
Cosa potrebbe essere?

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.