Web App Development

Tuesday, May 30, 2006

GridView Select All Client-Side Script

I had used a simple javascript function to check all/uncheck all items in a DataGrid. The same function can be modified to suit the new GridView in ASP.NET 2.0

  1. Create a template column and as a server-side checkbox to the ItemTemplate

  2. Create a client-side checkbox in the HeaderTemplate and double-click the item to insert a placeholder for the client-side javascript. The function is as below:

    function chkMasterApprove_onclick(aspCheckBoxID,checkVal)

    {
    re = new RegExp(aspCheckBoxID + '$') //to find the generated controlname

    for(i = 0; i < document.forms[0].elements.length; i++)

    {
    elm = document.forms[0].elements[i];

    if (elm.type == 'checkbox')

    {

    if (re.test(elm.name))

    {

    elm.checked = checkVal ;

    }

    }}
    }



Friday, May 26, 2006

Strategies for handling data upload from Websites

Even big corporatios still have data coming in from text files and Excel spreadsheets. I was designing an application where I had to handle data uploads through a Web application that must be queued, processed, and stored in a database. The possibilities turned out to be numerous and each strategy is dependent upon the business requirement.