Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add horizontal scroll bar at html div(id is PaymentGrid) which is dynamically created.
ASP
 <asp:Panel runat="server">
 <div class="row clearfix">
 <div class="col-md-12">
 <div class="box">
 <div class="box-body">
 <asp:Panel runat="server" >
 <div id="dvGridView" style="display: none">
 <table id="tblFPS" > </table>
</div>
</panel>
</div>
</div>
</div>
</div>
</panel>




JavaScript
var innerhtml = '<tr><td><div id=\"PaymentGrid\"><table overflow=\"auto\"   border=\"1\">'
innerhtml += "<thead class=\"thead-inverse\">";
                    innerhtml += "<tr>";
                    innerhtml += "<th>Sl. No.</th>";
                    innerhtml += "<th>Name of the Scheme</th>";
                    innerhtml += "<th style='text-align:right'>Alloc Qty</th>";
                    innerhtml += "<th style='text-align:right'>Remaining Qty</th>";
                    innerhtml += "<th style='text-align:right'>Quantity to be Lifted(A)</th>";
                    innerhtml += "<th style='text-align:right'>Commodity Rate(B)</th>";
                    innerhtml += "<th style='text-align:right'>Cartage Rate</th>";
                    innerhtml += "<th style='text-align:right'>Cartage Cost</th>";
                    innerhtml += "<th style='text-align:right'>Cartage Service Rate</th>";
                    innerhtml += "<th style='text-align:right'>Cartage Service Cost</th>";
                    innerhtml += "<th style='text-align:right'>Fix Cartage Rate</th>";
                    innerhtml += "<th style='text-align:right'>Fix Cartage Cost</th>";
                    innerhtml += "<th style='text-align:right'>Fix Cartage  Service Rate</th>";
                    innerhtml += "<th style='text-align:right'>Fix Cartage  Service Cost</th>";
                    innerhtml += "<th style='text-align:right'>Variable Commission(Rs)</th>";
                    innerhtml += "<th style='text-align:right'>Variable Commission Cost(Rs)</th>";
                    innerhtml += "<th style='text-align:right'>Fix Commission (Rs)</th>";
                    innerhtml += "<th style='text-align:right'>Fix Commission Cost(Rs)</th>";
                    innerhtml += "<th style='text-align:right'>Total Commission (G)</th>";
                    innerhtml += "<th style='text-align:right'>Commodity Cost (D=(A*B)-G)</th>";
                    innerhtml += "<th style='text-align:right'>Cartage Cost (E)</th>";
                    innerhtml += "<th style='text-align:right'>Total Amount Payable(F=D+E)</th>";
                    innerhtml += "</tr>";
                    innerhtml += "</thead>";


What I have tried:

$('#tblFPS').append(innerhtml );
Posted
Updated 7-Mar-16 20:11pm
v2
Comments
aarif moh shaikh 8-Mar-16 0:41am    
set style="overflow:scroll" of your table
Member 7909353 8-Mar-16 1:13am    
Not working

Replace you Panel3 tag with following

ASP.NET
<asp:panel id="Panel2" runat="server" style="width: 550px; overflow-x: auto; overflow-y: auto;height: 400px;" xmlns:asp="#unknown"></asp:panel>


This will set the height of your control to 400px and width to 550px. You can change it. Now in anycase if width or height exceeds these values a scroll will appear.
 
Share this answer
 
HTML
<style type="text/css">
    div.horizontal {
    width: 100%;
   
    overflow: auto;
}
        </style>

<div class="horizontal">
<table id="tblFPS"> </table></div>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900