Click here to Skip to main content
15,886,693 members
Articles / Web Development / HTML

A Server Control Authoring JavaScript

Rate me:
Please Sign up or sign in to vote.
4.33/5 (5 votes)
12 Jun 20067 min read 38.2K   379   30  
This is a short series of articles about Abstract Programming. This part is a look at C# authoring a JavaScript file at design time.
// Copyright ©  2005 - ProMatrix Inc.

function window_onload(msg)
{
	cCommon = new CCommon();
    downloadStatusTimer_start(msg);
    update_html_table();
}

function downloadStatusTimer_start(msg)
{
    f1.downloadStatus.value = msg;  
    setTimeout("downloadStatusTimer_stop()", 2000);
}

function downloadStatusTimer_stop()
{
    f1.downloadStatus.value = "NO";  
}

function CStorage1_auto_update()
{
    downloadStatusTimer_start("YES");
    update_html_table();
}

function onload_error(msg)
{
    alert(msg);
}

if(typeof CStorage1_dt == "undefined") CStorage1_dt = null;

function onload_sync()
{  // determine when loading this .js if we have the latest .js datatable on the client 
    cCommon = new CCommon();
    if(CStorage1_dt == null)	
    {  // this happens only the first time, because there is no .js datatable on the client  
	}else
	{  // pass datecode of datatable on the client 
        f1.sql_id.value = objCStorage1.datatable.sql_id;
        f1.datecode.value = objCStorage1.datatable.datecode;
    }
    f1.submit();
}

function update_html_table()
{
    zTable = new CTable("table1").zTable;
    headerRow = zTable.rows[0];

    row_count = objCStorage1.row_count();
    col_count = objCStorage1.col_count();

    // polulate header row
    htmlRow = zTable.rows[0];
    columns = objCStorage1.get_columns();
    for(j = 0; j < col_count; j++)
        htmlRow.cells[j].innerText = columns[j];

    // polulate data rows
    for(i = 0; i < row_count; i++)
    {
        htmlRow = zTable.rows[i + 1];
        for(j = 0; j < col_count; j++)
            htmlRow.cells[j].innerText = objCStorage1.get_val(i, j);
    }
}

//      Notes:
//    row_count = objCStorage1.row_count();
//    col_count = objCStorage1.col_count();
//    columns = objCStorage1.get_columns();
//    z = objCStorage1.datatable.rows[1];
//    zz = objCStorage1.get_val(1, 1);
//    zzz = objCStorage1.get_cval(1, "col1");

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
My formal education was in Electronic Engineering with a background in real-time data acquisition for aerospace. Early in my career, I switched my focus from hardware engineering to software engineering. Most, but not all, of my development experience has been using Microsoft technologies and tools. My current accomplishments are web applications using ASP.Net, SQL Server 2005, JavaScript, and Visual Studio Tools for Office. I enjoy all facets of a development life cycle, and have played almost all roles. Most recently, I have been involved in project technical leadership, architecture, and training, and I have created several small courses including this one on Abstract Programming.

Comments and Discussions