Make two divs inside bootstrap row responsive in ASP.Net

George616
 
on Dec 05, 2020 03:12 AM
Sample_205773.zip
2145 Views

Hello forum,

I have a <div class=”row”></div> and inside it are two other divs that are in the same row. The content of the first div is a canvas control and is displayed on the left of the screen while the content of the other div appears on the right.

In a smaller screen, I wanted the right div to move down the left div. but when I minimize the window, the content of the right div moves behind the content of the left div. Or alternatively, the content of the right div can be made to disappear.

I thought that when contents are inside a <div class=“row”></div> they will be responsive in smaller screens. From my HTML below, it will show the display when used.

Here is my full HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Invoice upload</title>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link href='https://fonts.googleapis.com/css?family=Comfortaa' rel='stylesheet' />
    <link href='https://fonts.googleapis.com/css?family=Nunito' rel='stylesheet' />
    <!-- jQuery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <!-- Popper JS -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>

    <!-- Bootstrap CSS CDN -->
    <link href="css/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" />
    <!-- Our Custom CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
    <!-- Scrollbar Custom CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css" />
    <!-- Font Awesome JS -->
    <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/solid.js" integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"></script>
    <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/fontawesome.js" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
    <!-- Font Awesome JS -->
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/responsive/1.0.7/js/dataTables.responsive.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/1.10.9/js/dataTables.bootstrap.min.js"></script>
    <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script type="text/javascript">
	$(document).ready(function() { 
		var $winwidth = $(window).width();
		$("#the-canvas").attr({
			width: $winwidth
		});
		$(window).bind("resize", function(){ 
			var $winwidth = $(window).width();
			$("#the-canvas").attr({
				width: $winwidth
			});
		 });
	}); 
    </script>
</head>
<body style="font-family: Constantia; background-color: #eeeeee;">
    <form id="form1" runat="server" enctype="multipart/form-data" method="POST">
        <div class="wrapper">
            <!-- Sidebar -->
            <nav id="sidebar">
                <ul class="list-unstyled components">
                    <li><a><asp:Label ID="named" runat="server" Font-Size="10pt" Text="" ForeColor="White"></asp:Label></a></li>
                    <li><a><img alt="" src="images/navbarimg/user-8-xxl.png" height="13"/>&nbsp;<asp:Label ID="user" runat="server" Font-Size="8pt" Text="" ForeColor="White"></asp:Label></a></li>
                    <li><a><img alt="" src="images/wallet-xxl.png" height="12" />&nbsp;<asp:Label ID="Units" runat="server" Font-Names="Comfortaa" Font-Size="8pt" Text="" ForeColor="White"></asp:Label></a></li>
                </ul>
                <ul class="list-unstyled components">
                    <li><a href="#">Home</a></li>
                    <li><a href="#">1st Document</a></li>
                    <li><a href="#">1st Document</a></li>
                    <li><a href="#">1st Document</a></li>
                    <li><a href="#">1st Document</a></li>
                </ul>
                <ul class="list-unstyled components">
                    <li id="dashboard" runat="server"><a href="#">Profile</a></li>
                    <li id="Li1" runat="server"><a href="#"> Details</a></li>
                </ul>
            </nav>
            <div id="content" style="font-size: 10pt;">
                <nav id="topnav" class="navbar navbar-expand-lg navbar-default navbar-inverse navbar-fixed-top" role="navigation" style="background-color: #eeeeee; font-size: small; font-family: Nunito;">
                    <div class="container-fluid">
                        <button type="button" id="sidebarCollapse" class="btn btn-info">
                            <i class="fas fa-align-left"></i>
                            <span class="sr-only">Toggle Navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
                        <h3 style="font-size: medium; font-weight: bolder; font: bolder; color: #00003D;">codex</h3>
                        <button class="btn btn-info d-lg-none ml-auto" id="sideCollapse" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                            <i class="fas fa-align-justify"></i>
                        </button>
                        <div class="collapse navbar-collapse" id="navbarSupportedContent">
                            <ul class="nav navbar-nav ml-auto">
                                <li class="nav-item">
                                    <a class="nav-link" href="Index.aspx" style="font-weight: bolder;">Home</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
                <hr />
                 <br />
          <div class="line"></div>
           <asp:Label ID="labelid" runat="server" Text=""></asp:Label><asp:Label ID="createby" runat="server" Text=""></asp:Label><asp:Label ID="role" runat="server" Text=""></asp:Label>
           <div class="container" id="centered" style="margin-top: -2%; font-family: Nunito;">
               <div class="form-horizontal">
                   <h1 style="font-size: small; margin-top: 0%; color: red;">ID Card with QR Code</h1>
                   <hr />
                   <div class="row">
                   <div class="mid-cont">
                       <br />
                       <div class="containr-fluid">
                           <asp:FileUpload runat="server" ID="showPreviewBill" />
                           <br /><br />
                       </div>
                       <div class="contentt">
                           <canvas id="the-canvas" style="border: 1px solid grey; height: 850px; width: 700px;"></canvas>
                       </div>
                        <asp:Button ID="buttonmail" runat="server" CssClass="btn btn-primary navbar-btn" BackColor="SteelBlue" Font-Size="9pt" Text="QR code" />
                   </div>
                       <div class="sidecontent" style="width: 25%;">
                           <div class="topcont" style="background-color: #fff; width:100%;">
                               <p>Invoice document can also be created and authenticated with the use of the embedded template. </p>
                               <i id="info" class="fa fa-info-circle"></i>
                           </div>
                           <div class="bottomcont" style="width:100%;">
                           <p> Invoice document can also be created and authenticated with the use of the embedded template. </p>
                               <i id="info1" class="fa fa-question-circle" aria-hidden="true"></i>
                           <p> Invoice document can also be created and authenticated with the use of the embedded template. </p>
                               <i id="info2" class="fa fa-question-circle" aria-hidden="true"></i>
                           <p> Invoice document can also be created and authenticated with the use of the embedded template. </p>
                       </div>
                       </div>
                   </div>
                   <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
               </div>
           </div>
                <br />
                <!-- Footer -->
                <footer class="page-footer font-small bg-light" style="background-color: #D1D1D1; font-family: Nunito; max-width: 100%; margin-bottom: 0%;">
                    <hr />
                    <div class="footer-copyright text-center py-3" style="font-size: 8pt;">
                     © Copyright <%=DateTime.Now.Year %>&nbsp;&nbsp;&nbsp;<a href="#" style="font-weight:bold; color:#00003D; font-size:10pt;">joscode.com</a>
                    </div>
                </footer>
            <!-- Footer -->
        </div>
    </div>
    </form>
</body>
</html>

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Dec 05, 2020 05:48 AM

Hi George616,

You need to use bootstrap grid layout. Refer below link.

https://getbootstrap.com/docs/4.0/layout/grid/

Set the class col-sm to the div inside the row class div.

<body style="font-family: Constantia; background-color: #eeeeee;">
    <form id="form1" runat="server" enctype="multipart/form-data" method="POST">
        <div class="wrapper">
            <!-- Sidebar -->
            <nav id="sidebar">
                <ul class="list-unstyled components">
                    <li>
                        <a>
                            <asp:Label ID="named" runat="server" Font-Size="10pt" Text="" ForeColor="White"></asp:Label></a>
                    </li>
                    <li>
                        <a>
                            <img alt="" src="images/navbarimg/user-8-xxl.png" height="13" />&nbsp;<asp:Label ID="user" runat="server" Font-Size="8pt" Text="" ForeColor="White"></asp:Label></a>
                    </li>
                    <li>
                        <a>
                            <img alt="" src="images/wallet-xxl.png" height="12" />&nbsp;<asp:Label ID="Units" runat="server" Font-Names="Comfortaa" Font-Size="8pt" Text="" ForeColor="White"></asp:Label></a>
                    </li>
                </ul>
                <ul class="list-unstyled components">
                    <li>
                        <a href="#">Home</a>
                    </li>
                    <li>
                        <a href="#">1st Document</a>
                    </li>
                    <li>
                        <a href="#">1st Document</a>
                    </li>
                    <li>
                        <a href="#">1st Document</a>
                    </li>
                    <li>
                        <a href="#">1st Document</a>
                    </li>
                </ul>
                <ul class="list-unstyled components">
                    <li id="dashboard" runat="server"><a href="#">Profile</a>
                    </li>
                    <li id="Li1" runat="server"><a href="#">Details</a>
                    </li>
                </ul>
            </nav>
            <div id="content" style="font-size: 10pt;">
                <nav id="topnav" class="navbar navbar-expand-lg navbar-default navbar-inverse navbar-fixed-top" role="navigation" style="background-color: #eeeeee; font-size: small; font-family: Nunito;">
                    <div class="container-fluid">
                        <button type="button" id="sidebarCollapse" class="btn btn-info">
                            <i class="fas fa-align-left"></i>
                            <span class="sr-only">Toggle Navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
                        <h3 style="font-size: medium; font-weight: bolder; font: bolder; color: #00003D;">codex</h3>
                        <button class="btn btn-info d-lg-none ml-auto" id="sideCollapse" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                            <i class="fas fa-align-justify"></i>
                        </button>
                        <div class="collapse navbar-collapse" id="navbarSupportedContent">
                            <ul class="nav navbar-nav ml-auto">
                                <li class="nav-item">
                                    <a class="nav-link" href="Index.aspx" style="font-weight: bolder;">Home</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </nav>
                <hr />
                <br />
                <div class="line"></div>
                <asp:Label ID="labelid" runat="server" Text=""></asp:Label><asp:Label ID="createby" runat="server" Text=""></asp:Label><asp:Label ID="role" runat="server" Text=""></asp:Label>
                <div class="container" id="centered" style="margin-top: -2%; font-family: Nunito;">
                    <div class="form-horizontal">
                        <h1 style="font-size: small; margin-top: 0%; color: red;">ID Card with QR Code</h1>
                        <hr />
                        <div class="row">
                            <div class="mid-cont col-sm">
                                <br />
                                <div class="containr-fluid">
                                    <asp:FileUpload runat="server" ID="showPreviewBill" />
                                    <br />
                                    <br />
                                </div>
                                <div class="contentt">
                                    <canvas id="the-canvas" style="border: 1px solid grey; height: 850px; width: 650px;"></canvas>
                                </div>
                                <asp:Button ID="buttonmail" runat="server" CssClass="btn btn-primary navbar-btn" BackColor="SteelBlue" Font-Size="9pt" Text="QR code" />
                            </div>
                            <div class="sidecontent col-sm">
                                <div class="topcont" style="background-color: #fff; width: 100%;">
                                    <p>Invoice document can also be created and authenticated with the use of the embedded template. </p>
                                    <i id="info" class="fa fa-info-circle"></i>
                                </div>
                                <div class="bottomcont" style="width: 100%;">
                                    <p>Invoice document can also be created and authenticated with the use of the embedded template. </p>
                                    <i id="info1" class="fa fa-question-circle" aria-hidden="true"></i>
                                    <p>Invoice document can also be created and authenticated with the use of the embedded template. </p>
                                    <i id="info2" class="fa fa-question-circle" aria-hidden="true"></i>
                                    <p>Invoice document can also be created and authenticated with the use of the embedded template. </p>
                                </div>
                            </div>
                        </div>
                        <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
                    </div>
                </div>
                <br />
                <!-- Footer -->
                <footer class="page-footer font-small bg-light" style="background-color: #D1D1D1; font-family: Nunito; max-width: 100%; margin-bottom: 0%;">
                    <hr />
                    <div class="footer-copyright text-center py-3" style="font-size: 8pt;">
                        © Copyright <%=DateTime.Now.Year %>&nbsp;&nbsp;&nbsp;<a href="#" style="font-weight: bold; color: #00003D; font-size: 10pt;">joscode.com</a>
                    </div>
                </footer>
                <!-- Footer -->
            </div>
        </div>
    </form>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.concat.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.0.943/pdf.min.js"></script>

    <script src="js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
 
            $("#sidebar").mCustomScrollbar({
                theme: "minimal"
            });
 
            $('#sidebarCollapse').on('click', function () {
                // open or close navbar
                $('#sidebar').toggleClass('active');
                // close dropdowns
                $('.collapse.in').toggleClass('in');
                // and also adjust aria-expanded attributes we use for the open/closed arrows
                // in our CSS
                $('a[aria-expanded=true]').attr('aria-expanded', 'false');
            });
 
        });
    </script>
</body>