Advertisement

Advertisement

Using Bootstrap Theme icons toastr(notification)

 Using Bootstrap Theme icons

For Theme 

1. https://bootswatch.com/ link pe ja k super hero  theme ka css download kr k open karenge to notepad me code hoga, usko copy kr k vs k project me  ja wwwroot k  css folder me css file create kr paste kr denge code phir Layout k uper me css link ko comment kr  ye link <link rel="stylesheet" href="~/css/superherobootswatchtheme.css" />  paste kr denge.

 

https://www.youtube.com/watch?v=_bNtVsX8Ym8&t=2512s

For Icon

         2.Layout me css link k just niche ye link  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css"> ko paste kr denge




index.cshtml

<td>  
<a asp-action="Edit" asp-route-id="@item.Id"><i class="bi bi-pencil-square">Edit</i></a> |
<a asp-action="Details" asp-route-id="@item.Id"><i class="bi bi-file-person-fill">Details</i></a> |
<a asp-action="Delete" asp-route-id="@item.Id"><i class="bi bi-trash">Delete</i></a>
</td>

For Toastr

2.Layout me css link k just niche ye link <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css"> ko paste kr denge phir Layout  me @RenderBody() k uper <partial name="_Notification"/> paste kar denge, shared folder me _Notification.cshtml view page create krenge  n 


_Notification.cshtml 

@if (TempData["success"] != null)
{
    <h2>@TempData["success"]</h2>

<script src="~/lib/jquery/dist/jquery.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script>
    // Display a warning toast, with no title
        toastr.success('@TempData["success"]')</script>
}

@if (TempData["error"]!=null)
{
    <h2>@TempData["error"]</h2>
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
    <script>
        // Display a warning toast, with no title
        toastr.success('@TempData["success"]')</script>
}






Using Bootstrap Theme icons toastr(notification) Using Bootstrap Theme icons toastr(notification) Reviewed by Rikesh on June 29, 2023 Rating: 5

No comments:

Powered by Blogger.