Showing posts with label ASP.NET. Show all posts
Showing posts with label ASP.NET. Show all posts

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.













Tuesday, August 23, 2011

ASP.NET Page Life Cycle

ASP.NET Page Life-cycle

Page Request
The page request occurs before the page life cycle begins. when the page is requested by a user, asp.net determines whether the page needs to be parsed and compiled (therefore beginning the life of of a page), or whether a cached version of the page can be sent in response without running the page.
Start
In the start stage, page properties such as Request and Response are set. At this stage, the page also determines whether the request a post back or a new request and sets Ispostback property. the page also sets the UICulture property.
Initialization :
During page initialization, controls on the pager are available and each control's UniqueID property is set. A master page and themes are also applied to the page if applicable. if the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state
Load
During load, if the current request is postback, control properties are loaded with information recovered from view state and control state.
Post Back Event Handling
If the request is a postback, control event handlers are called. after that, the validate method of all validator controls is called, which sets the Isvalid property of individual validator controls an of the page
Rendering
Before rendering, view state is saved for the page and all controls. During the rendering stage, the page calls the Render method for each control, providing  a text writers its output to the output stream object of the page's response property.
Unload
The unload event raised after the page has been fully rendered, sent to the client, and is ready to be discarded. at this point, page properties such as response and request are unloaded and cleanup is performed.