ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Scrollable HTML DIV with fixed header in ASP.Net MVC<p>Hi&nbsp;kavithav,</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">Controller</span></strong></p> <pre class="brush: csharp">public class HomeController : Controller { // GET: /Home/ public ActionResult Index() { List&lt;StudentModel&gt; model = new List&lt;StudentModel&gt;(); model.Add(new StudentModel { Name = &#34;Ram&#34;, Type = &#34;A001&#34; }); model.Add(new StudentModel { Name = &#34;Hari&#34;, Type = &#34;A002&#34; }); model.Add(new StudentModel { Name = &#34;Rahim&#34;, Type = null }); model.Add(new StudentModel { Name = null, Type = &#34;A004&#34; }); TempData[&#34;StudentList&#34;] = model; return View(); } public class StudentModel { public string Name { get; set; } public string Type { get; set; } } }</pre> <p><strong><span style="text-decoration: underline;">View</span></strong></p> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;title&gt;Index&lt;/title&gt; &lt;style type=&#34;text/css&#34;&gt; #dvScroll { max-height: 150px !important; overflow-y: auto !important; background: #f9f9f9 !important; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;% List&lt;_ScrollBar_DIV.Controllers.HomeController.StudentModel&gt; Rows = (List&lt;_ScrollBar_DIV.Controllers.HomeController.StudentModel&gt;)TempData[&#34;StudentList&#34;]; %&gt; &lt;div id=&#34;divInfo&#34; style=&#34;width: 100%;&#34; class=&#34;Table brd&#34;&gt; &lt;div class=&#34;row&#34;&gt; &lt;div class=&#34;applystyle&#34; style=&#34;float: left; width: 75%; line-height: 24px; margin: 0; padding-left: 5px;&#34;&gt; &lt;p&gt; Name &lt;/p&gt; &lt;/div&gt; &lt;div class=&#34;applystyle&#34; style=&#34;float: left; width: 15%; line-height: 24px; margin: 0; padding-left: 5px;&#34;&gt; &lt;p&gt; Type &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;% if (Rows.Count &gt; 0) {%&gt; &lt;div class=&#34;row&#34; style=&#34;width: 100%&#34; id=&#34;dvScroll&#34;&gt; &lt;% foreach (var value in Rows) {%&gt; &lt;div class=&#34;applystyle&#34; style=&#34;float: left; width: 75%; line-height: 24px; margin: 0; padding-left: 5px;&#34;&gt; &lt;%if (value.Name != null) {%&gt; &lt;p style=&#34;word-wrap: break-word;&#34;&gt;&lt;%=value.Name%&gt;&lt;/p&gt; &lt;%} else {%&gt; &lt;p&gt;N/A&lt;/p&gt; &lt;%}%&gt; &lt;/div&gt; &lt;div class=&#34;applystyle&#34; style=&#34;float: left; width: 15%; line-height: 24px; margin: 0; padding-left: 5px;&#34;&gt; &lt;%if ((value.Type != null)) {%&gt; &lt;p style=&#34;word-wrap: break-word;&#34;&gt;&lt;%=value.Type%&gt;&lt;/p&gt; &lt;%} else {%&gt; &lt;p&gt;N/A&lt;/p&gt; &lt;%}%&gt; &lt;/div&gt; &lt;%}%&gt; &lt;/div&gt; &lt;%} else {%&gt; &lt;div class=&#34;row&#34; style=&#34;width: 100%&#34;&gt; &lt;div class=&#34;applystyle&#34; style=&#34;float: left; width: 75%; line-height: 24px; margin: 0; padding-left: 5px;&#34;&gt; &lt;p&gt;&lt;/p&gt; &lt;/div&gt; &lt;div class=&#34;applystyle&#34; style=&#34;float: left; width: 15%; line-height: 24px; margin: 0; padding-left: 5px;&#34;&gt; &lt;/div&gt; &lt;/div&gt; &lt;%}%&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/uSrpOfP.gif" alt="" width="294" height="279" /></span></strong></p>https://www.aspforums.net:443/Threads/819399/Scrollable-HTML-DIV-with-fixed-header-in-ASPNet-MVC/https://www.aspforums.net:443/Threads/819399/Scrollable-HTML-DIV-with-fixed-header-in-ASPNet-MVC/Tue, 09 Jul 2019 00:53:57 GMT