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

Unable to set toast position or show more than once

Thread ID:

Created:

Updated:

Platform:

Replies:

146287 Jul 29,2019 11:59 PM UTC Jul 30,2019 10:35 AM UTC Blazor 1
loading
Tags: Toast
Dominick Marciano
Asked On July 29, 2019 11:59 PM UTC

I am trying to set the X position of a toast notification.  The documentation shows that this can be set using the following:

<ToastPosition X="Center"></ToastPosition>

However, if I try to do this directly in the HTML (on a server-side Blazor project), it shows the following error message:

The name 'Center' does not exist in the current context

And if I try to set it directly in code via the controls reference like so:

toastSuccess.Position = "Center"

It gives the following error:

Cannot implicitly convert type 'string' to 'Syncfusion.EJS2.Blazor.Notifications.ToastPosition'

However, if I write one of the following:

<ToastPosition X=@(new ToastPosition(){ X = "Center" }))></ToastPosition>
toastSuccess.Position = new ToastPosition() { X = "Center" };

Then no error message is reported and the project compiles/runs but the toast won't show.  If I completely remove all code trying to set the position, then the toast will successfully show in the upper right hand corner of the window.  However, once it disappears, if I click the button to open it again, it won't open and the following error is reported in the Google Chrome console:

e.match is not a function
TypeError: e.match is not a function
    at https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:11837
    at le (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:13181)
    at Object.Db.compile.e.compile (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:477637)
    at ce (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:13424)
    at t.fetchEle (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:7523367)
    at t.setContent (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:7528933)
    at t.personalizeToast (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:7525455)
    at t.show (https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js:1:7521287)
    at call (https://cdn.syncfusion.com/ej2/17.2.34/dist/ejs.interop.min.js:1:7115)
    at https://localhost:44361/_framework/blazor.server.js:8:21434

If I refresh the page, then clicking the button shows the toast message again, but only on the first click and all subsequent clicks show the above error message.


Pandiyaraj Muniyandi [Syncfusion]
Replied On July 30, 2019 10:35 AM UTC

Hi Dominick, 

Greetings from Syncfusion support.  
 
Query 1: I am trying to set the X position of a toast notification.  The documentation shows that this can be set using the following 

We have validated the reported issue and able reproduce from our end, we confirmed “Position property has object type instead of specific type in Toast” as a defect from our end and logged a report for the same. We will validate and include the fix in upcoming nuget patch release. 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link, 

Also we suggest you to use the following workaround until then the fix included. Create and bind the X, Y position value from code behind as mentioned below. 

<EjsToast @ref="Toast1Obj" Title="Matt sent you a friend request" Content=@ToastContent> 
    <ToastPosition X=@XPos Y=@YPos></ToastPosition> 
</EjsToast> 

@code{ 
    public string XPos = "Center"; 
    public string YPos = "Top"; 
} 
 
Query 2: However, once it disappears, if I click the button to open it again, it won't open and the following error is reported in the Google Chrome console 
 
We have tried to replicate the issue with the given code and the following ways, but we were not able to reproduce the issue at our end. The toast notification is showed every time on click. 
  • Binding position value from code behind
  • Without configure a position property
We have prepared sample for your reference, get it from below link  

Still if you face same issue, please share your code or modify the above sample to reproduce your issue and revert it to us. This will help us provide a solution.
   
 
Regards, 
Pandiyaraj M 


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