We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dialog button in dialog does not fire OnClick event anymore.

Thread ID:

Created:

Updated:

Platform:

Replies:

150748 Jan 17,2020 10:25 PM UTC Nov 18,2020 11:21 AM UTC Blazor 10
loading
Tags: Dialog
Admir Hodžic
Asked On January 17, 2020 10:25 PM UTC

On  version  v17.4.43  looks like buttons  in  Dialog does not fire events on click
This was working in version V17.4.40 Now I do not get fire event on click of buuton
Is there something new I realy did not get breaking changes for dialog or digalog buttons


@using Microsoft.AspNetCore.Hosting

@using Syncfusion.EJ2.Blazor.Popups;
@using Syncfusion.EJ2.Blazor.Buttons;
@using System.IO;
@inject IWebHostEnvironment hostingEnv;



<div class="@CssKlasa">
    <button class="e-btn" @onclick="@OnBtnClick">Isprazni folder</button>
    <EjsDialog @ref="DialogObj" Width="335px" Visible="false" CloseOnEscape="true" IsModal="true">
        <DialogTemplates>
            <Header>Da li ste siguni da želite isprazniti CDR folder   </Header>
            <Content> <p>U folderu sam našao @datoteka datoteka</p><br /><p style="white-space: pre-line">@greska</p> </Content>
        </DialogTemplates>
        <DialogButtons>
            <DialogButton ButtonModel="@DialogBtnOk" OnClick="DialogBtnOkClicked"></DialogButton>
            <DialogButton ButtonModel="@DialogBtnJok" OnClick="DialogBtnJokClicked"></DialogButton>
        </DialogButtons>

        <DialogAnimationSettings Effect="@DialogEffect.None"></DialogAnimationSettings>
        <DialogEvents OnOpen="OnOpen"></DialogEvents>
    </EjsDialog>
</div>
@code {

    [Parameter]
    public string CssKlasa { get; set; }

    [Parameter]
    public EventCallback<bool> ObrisaoSamContentFoldera { get; set; }

    string greska = string.Empty;

    EjsDialog DialogObj;

    private ButtonModel DialogBtnOk = new ButtonModel
    {
        Content = "Obriši",
        IsPrimary = true,
        IconCss = "far fa-trash-alt"
    };
    private ButtonModel DialogBtnJok = new ButtonModel
    {
        Content = "Zatvori",

    };
    long datoteka = 0;
    private void OnBtnClick()
    {
        this.DialogObj.Show();
    }
    private void DialogBtnOkClicked()
    {
        try
        {
            System.IO.DirectoryInfo di = new DirectoryInfo(System.IO.Path.Combine(hostingEnv.ContentRootPath, "par"));

            foreach (System.IO.FileInfo file in di.GetFiles())
            {
                file.Delete();
            }
            ObrisaoSamContentFoldera.InvokeAsync(true);
            this.DialogObj.Hide();
        }
        catch (Exception ex)
        {
            greska = $"Nisam uspijeo obrisati daoteke sa greškom{ex.Message}";
        }
    }
    private void DialogBtnJokClicked()
    {
        this.DialogObj.Hide();
    }
    private void ObrisiFolderClicked()
    {
        this.DialogObj.Show();
    }
    private void OnOpen()
    {


        this.datoteka = Directory.GetFiles(System.IO.Path.Combine(hostingEnv.ContentRootPath, "par"), "*.*").Length;
    }

}


James
Replied On January 20, 2020 04:03 AM UTC

I have the same issue.

Admir Hodžic
Replied On January 20, 2020 07:33 AM UTC

My project is on v3.1.1 ov Microsoft nuggets.
Is yours also on 3.1.1, maybe new update of Microsoft tools brake this functionality  

Indrajith Srinivasan [Syncfusion]
Replied On January 20, 2020 12:37 PM UTC

Hi Admir, 
  
Currently, we validating the reported issue, will update further details shortly.  
  
Regards,
Indrajith
 


Indrajith Srinivasan [Syncfusion]
Replied On January 20, 2020 05:21 PM UTC

Hi Admir,

Greetings from Syncfusion support
 
 
We suspect this to be a defect from our end, we will include this fix in our next nuget release until then can you use the below nuget package to resolve the issue in your end.

Sample: https://www.syncfusion.com/downloads/support/forum/150748/ze/BlazorDialog-2061670139

Nuget package: https://www.syncfusion.com/downloads/support/forum/150748/ze/Syncfusion.EJ2.Blazor.17.4.0.46-1062011802

Can you please try out the above solution and let us know if you face any difficulties.
 
 
Regards, 
Indrajith 


Laurin S
Replied On November 15, 2020 04:14 PM UTC

Hi, I have the same issue but in React. I also have a Dialog and inside the Dialog a Button. The button is not firing the onClick Event. 

    <DialogComponent
      ref={dialogRef}
      allowDragging={true}
      closeOnEscape={false}
      showCloseIcon={true}
      header={header}
      visible={false}
      width="350px"
    >
        <div>
            <ButtonComponent onClick={start}>Start</ButtonComponent>
        </div>
    </DialogComponent>

Indrajith Srinivasan [Syncfusion]
Replied On November 16, 2020 07:48 AM UTC

Hi Laurin, 
 
Good day to you, 
 
We have validated your reported query. We have tried to reproduce the reported issue using the shared code blocks, unfortunately we couldn’t find any issues from our end. We have also shared the ensured sample from our end 
 
 
If possible, can you replicate the issue in the above sample and revert back to us ?.  So that we can validate and provide solution at earliest. 
 
Regards, 
Indrajith 


Laurin S
Replied On November 16, 2020 04:48 PM UTC

Hey, thanks for the quick reply. Unfortunately, in my piece of code the button onClick event is not working. If could check my attached file, thank you very much.
Also, the useState variables/methods are not really working as expected (in the attached file). Maybe, this misbehavior is somehow correlated... Or there is an error on my side... I don't know, just wanted to add this.

Attachment: DStopWatch_35d8f69a.zip

Indrajith Srinivasan [Syncfusion]
Replied On November 17, 2020 12:52 PM UTC

Hi laurin, 
 
Good day to you, 
 
We have checked the shared attachment. We couldn’t make an runnable sample using the share attachments. We have also checked the reported issue by configuring the way you have used the dialog in your application. Can you share us the following details ? 
 
  • Is the button click action, working for an normal JavaScript button ?
  • Can you try using the shared sample code blocks, in your application and check the reported issue ?
 
If possible can you replicate the issue in the already shared sample and revert back to us ? 
 
Regards, 
Indrajith 


Laurin S
Replied On November 17, 2020 04:00 PM UTC

Hi,
below the answers:

  • Is the button click action, working for an normal JavaScript button ? No (see attached code)
  • Can you try using the shared sample code blocks, in your application and check the reported issue ? Not working, see attached code
I prepared a new example project, where the button click events are not fired.
In addition, I discovered that the header template of the Dialog does not update/re-render when a state variable changes (see attached code with the example of the "this.state.title" variable).

Attachment: exampleapp_ea5d6be1.zip

Indrajith Srinivasan [Syncfusion]
Replied On November 18, 2020 11:21 AM UTC

Hi Laurin, 
 
We have checked the shared sample and faced the below error while running the sample. We have also prepared a sample, using the shared code blocks and the click action works fine for both the buttons. The header template is not updated, since its value is not passed directly to the header property(header={this.state.title}). Check the below stackblitz sample prepared using the shared code blocks for reference. 
 
Facing below error when running the shared sample: 
 
 
 
 
Please check the above sample and let us know if it meets your requirements? 
 
Regards, 
Indrajith 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon