Opt In (Do Not Edit Here)

Showing posts with label Web Application. Show all posts
Showing posts with label Web Application. Show all posts

Mar 11, 2012

Creating HTMLTable Dynamically

          The blog is intended to demonstrate the use of some HTMLControls for dynamically generating the HTMLTable on webpage using some piece of code.
          Required Namespace: System.Web.UI.HtmlControls

Controls used:
1.    Two Textboxes (txtRow & txtCol)
2.    One Button (btnClick)
3.    One Blank Table (htmlTable1)

Step 1: Accept the no. of Rows and Columns from User.
            int row = Convert.ToInt32(txtrow.Text);     // No. of Rows
            int col = Convert.ToInt32(txtcol.Text);     // No. of Columns
 Listing 1

Step 2: Now, Initialize the new TableRow & TableCell to add Data into Table.
            for (int i = 0; i < row; i++)
                  HtmlTableRow rows = new HtmlTableRow();         //a new Row
                  for (int j = 0; j < col; j++)
                        HtmlTableCell cell = new HtmlTableCell(); //a new Cell
Listing 2

Step 3: You can put any data into Cell, also can make some FORMATTING for good looks, and then add this cell to the row element…
                   cell.InnerHtml = i + "," + j;               //Insert Data into Cell
            cell.Align = "Center";
            cell.BorderColor = "Gray";
            rows.Cells.Add(cell);                       //Attach Cell with Row
Listing 3

Step 4: Now, simply insert this row element into htmlTable1 to display that row on the screen.

               htmlTable1.Rows.Add(rows);                      //Attach Row with Table
Listing 4

Step 5: Now execute the web application and see the result.

Intended Result:

Figure 1


          In this piece of writing, we see how to generate the HTML table with user accepted rows and columns. For writing the code here I used the C# and ASP.NET.

May 12, 2011

FileSystemObject - Drive Object

1.     First we have to declare four variables.

     Dim FSO, Drive, AllDrive, type

2.    Now create an instance of FileSystemObject and access all the available drives in computer.
      FSO = Server.CreateObject("Scripting.FileSystemObject")

     AllDrive = FSO.Drives

3.    Now display the Information for each drive

     Response.Write("Demo - Drive Object ")
For Each Drive In AllDrive

        Response.Write("Drive Letter :"+ Drive.DriveLetter()+"")
Response.Write("Path :  " + Drive.Path())
Response.Write("IsReady : " + Drive.IsReady().ToString)

   If Drive.IsReady Then   'To Retrieve the Type of Drive
      Response.Write("Drive Type : ")
      Select Case Drive.DriveType()
      'Property DriveType() Returns a Value indicating
      'the Type of a Specified Srive.
          Case 0 : type = "Unknown"
          Case 1 : type = "Removable"
          Case 2 : type = "Fixed"
          Case 3 : type = "Network"
          Case 4 : type = "CD-ROM"
          Case 5 : type = "RAM Disk"
      End Select

      'To Retrieve the Name of the Drive
      Response.Write("Volume Name : " + Drive.VolumeName)

      'To Retrieve the Type of File System
      Response.Write("File System : " + Drive.FileSystem)

      'To Retrieve the Total of the Specified Drive in GigaByte(GB)
      'The Division by(1024*1024*1024) to the Specified Property
      'is Done to get the Size of specified Drive in GigaByte
      Response.Write("Total Size : " + (Drive.TotalSize() / (1024 * 1024 * 1024)).ToString + " GigaByte")

      'The value returned by the FreeSpace property is typically         'the same as that returned the AvailableSpace property.              'Differences may occur between the two for
      'computer systems that support quotas.
      Response.Write("Free Space : " + (Drive.FreeSpace() /(1024 * 1024 * 1024)).ToString + " GigaByte")
      Response.Write("Available Space : "+(Drive.AvailableSpace() / (1024 * 1024 * 1024)).ToString + " GigaByte")

       'To Retrieve the Serial Number(in Hex) of 
       'the Specified Drive
        Response.Write("Drive Serial Number : " + Hex(Drive.SerialNumber))
    End If

4.    The Output will be as follows…..

Objects and Collections of FileSystemObject


          Contains methods and properties that allow you to create, delete, gain information about, and generally manipulate drives, folders, and files. Many of the methods associated with this object duplicate those in other FSO objects; they are provided for convenience.

          Contains methods and properties that allow you to gather information about a drive attached to the system, such as its share name and how much room is available. Note that a "drive" isn't necessarily a hard disk, but can be a CD-ROM drive, a RAM disk, and so forth. A drive doesn't need to be physically attached to the system; it can also be logically connected through a network.

          Contains methods and properties that allow you to create, delete, or move a file. Also allows you to query the system for a file name, path, and various other properties.

          Contains methods and properties that allow you to create, delete, or move folders. Also allows you to query the system for folder names, paths, and various other properties.

          Allows you to read and write text files.


          Provides a list of the drives attached to the system, either physically or logically. The Drives collection includes all drives, regardless of type. Removable-media drives need not have media inserted for them to appear in this collection.

          Provides a list of all files contained within a folder.

          Provides a list of all the folders within a Folder.


FileSystemObject Basics

          When writing scripts for Active Server Pages, the Windows Script Host, or other applications where scripting can be used, it's often important to add, move, change, create, or delete folders (directories) and files on the Web server. It may also be necessary to get information about and manipulate drives attached to the Web server.
     Scripting allows to process drives, folders, and files using the FileSystemObject (FSO) object model.

FileSystemObject (FSO) Object Model 

          The FileSystemObject (FSO) object model allows using the familiar object.method syntax with a rich set of properties, methods, and events to process folders and files.
This object-based tool can be with: 

  • HTML to create Web pages 
  • Windows Scripting Host to create batch files for Microsoft Windows 
  • Script Control to provide a scripting capability to applications developed in other languages


  • The FSO object model gives server-side applications the ability to create, alter, move, and delete folders, or to detect, and also to get the information about folders, such as their names, the date they were created or last modified, and so forth.

o   The FSO object model makes easy to process the files (such as create files, insert and change the data, and output (read) the data).

  • Also supports text file creation and manipulation through the TextStream object.


          Because use of the FSO on the client side raises serious security issues about providing potentially unwelcome access to a client's local file system, this documentation assumes use of the FSO object model to create scripts executed by Internet Web pages on the server side. Since the server side is used, the Internet Explorer default security settings do not allow client-side use of the FileSystemObject object. Overriding those defaults could subject a local computer to unwelcome access to the file system, which could result in total destruction of the file system's integrity, causing loss of data, or worse.

Apr 28, 2011


In this Post, We are going to see some differences between ASP and ASP.NET with simple Key points.

Parameters for Comparison

Also Known as Classic ASP
Is enhanced version of ASP

Application Environment
Is Interpreted
Is Compiled

Supported Language(s)
HTML, XML, Scripts, ActiveX, Server Components
All .NET Framework  supported languages

Scripting Language(s) used
VBScript and Jscript
VB.NET, C#, J#, Jscript.NET

Event Driven Programming
Is not available
Is available with in-built controls

Technology used for Database Operations

Server Controls
Not Present
Rich set of Server Controls  (like Web & HTML Controls) are present

Separation of Code from Content
Not Possible
Is Possible

Session and Application State Management Facility
Limited Access
Complete Access

 Error handling system
Is Poor
Is Full Proof

Deployment and Configuration

All Rights Reserved. 2014 Copyright SIMPLITONA

Powered By Blogger | Published By Gooyaabi Templates Designed By : BloggerMotion