HOW TO DISPLAY COUNT NUMBER OF SCREEN IN BOOTSTRAP

Sachin Singh

Total Post:26

Points:182
Posted by  Sachin Singh
 1070  View(s)
Ratings:
Rate this:
Hi Everyone,

I have make a tab menu with the help of bootstrap in my asp.net mvc application.
and i want to display a number of screen(Count) of the under home tab.
and display count in a button name then after number of count.

Here, my code:

@{
    ViewBag.Title = "";
    <script src="~/Scripts/jquery-1.9.1.min.js"></script>
    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    <script src="~/Scripts/bootstrap.min.js"></script>
}
 
<html>
<body>
    <div>
        <ul class="nav nav-tabs" role="tablist">
             <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
</ul>
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane active" id="home">
                <br />
                <br />
                <button class="btn btn-primary" type="button">
                    Total Screens
                </button>
                @foreach (var item in ViewBag.scr)
                {
                    <li>@item</li>
                }
            </div>

Please help me.

Thank you.



  1. Anupam Mishra

    Post:135

    Points:949
    Re: How to display count number of screen in Bootstrap

    Hi Sachin,


    You use this code:

     

    <div>
            <ul class="nav nav-tabs" role="tablist">
                 <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
                @foreach (var item in ViewBag.scr)
                {
                     <li role="presentation"><a href="#adminpanel" aria-controls="adminpanel" role="tab" data-toggle="tab">@item</a></li>
                }
            </ul>
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active" id="home">
                    <br />
                    <br />
                    <button class="btn btn-primary" type="button">
                        Total Screens <span class="badge">@ViewBag.count</span>
                    </button>
                    <br />
                    <br />
                    <br />
                    @foreach (var item in ViewBag.scr)
                    {
                        <li>@item</li>
                    }
                </div>
            </div>
        </div>


    In Controller :
    ViewBag.count = ScreenList.Count();

    Output:



Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!