Friday, February 12, 2016

How to Create table using javascript

How to create table in javascript ?

use this below to create html table in javascript
html table like below will add to your div element dynamically
<table border="1">
<tr>
<td>
Hello world.
<td/>
<tr/>
<table/>

Code :
var tr,td;   ---variables for row and cell
var Table =document.createElement('TABLE'); ---Here table will create
Table.setAttribute("border",1);    -- adds border to table.
tr=Table.insertRow(0);  --- new row for Table
td=tr.insertCell(0) ;        ---- new cell for tr (Row)
td.innerHTML ="Hello World";   --- Text that you want to display

'lets add this table to Document.

document.getElementById('divMain').appendChild(Table);  --- Div is your body div where you want to add.

more example
for(i =0;i< 20;i++)
{
 tr=Table.insertRow(Table.rows.length);
td=tr.insertCell(tr.cells.length);
td.innerHTML="Hello";
td=tr.insertCell(tr.cells.length);
td=tr.insertCell(tr.cells.length);
td.innerHTML ="World";
 }

document.getElementById("divMain").appendChild("Table");



---- Queries post here.













Thursday, February 4, 2016

MVC 6 and Entity Frame work 6

Model view controller with entity framework we build the application easily.
by using MVC scaffolding.
What is MVC scaffolding it will creates table classes in application.
and take care of the relations between tables....