Pass ViewBag to toast content

Dear Syncfusion Support

I try using toast notification as per code belows

 <ejs-toast id="toast_default" title="Success" content="xxxxx" icon="e-success toast-icons" close="onclose" beforeOpen="onBeforeOpen">
            <e-toast-position X="Right"></e-toast-position>
        </ejs-toast>
        <div class="col-lg-12 col-sm-12 col-md-12 center">
            <div id="toastBtnDefault" style="margin: auto;text-align: center;visibility:hidden">
                <button class="e-btn" id="toastBtnShow">Show Toasts</button>
                <button class="e-btn" id="toastBtnHide">Hide All</button>
            </div>
        </div>

how i can pass viewbag information into content = "xxxx"

appreciate on your feedback on this matters.

Thanks

3 Replies

CI Christopher Issac Sunder K Syncfusion Team October 12, 2018 10:58 AM UTC

Hi haryzad, 

Thank you for contacting Syncfusion support. 

To pass the content of Toast through ViewBag, you can make use of the following code snippet, 

Index.cshtml 

<ejs-toast id="toast_default" title="Success" content="@ViewBag.toast" icon="e-success toast-icons"> 
   </ejs-toast> 

HomeController.cs 

public IActionResult Index() 
        { 
            ViewBag.toast = "Toast content"; 
            return View(); 
        } 


Please let us know if you need further assistance. 

Thanks, 
Christo


HA haryzad October 13, 2018 02:20 AM UTC

Hi Christo

Thanks for your feedback, the solution workable for me


CI Christopher Issac Sunder K Syncfusion Team October 15, 2018 04:06 AM UTC

Hi haryzad, 

We are glad to hear that the provided solution worked for you. Please contact us if you need further assistance. 

Thanks, 
Christo

Loader.
Up arrow icon