Home > DeveloperSection > Forums > How to display count number of screen in Bootstrap
Sachin Singh
Sachin Singh

Total Post:26

Points:182
Posted on    March-28-2016 12:29 AM

 Bootstrap ASP.Net  Bootstrap  ASP.NET MVC  Bootstrap Modal  Bootstrap Tab 
Ratings:


 1 Reply(s)
 426  View(s)
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.





Anupam Mishra

Total Post:135

Points:949
Posted on    March-28-2016 12:35 AM

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:




Don't want to miss updates? Please click the below button!

Follow MindStick