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




Description:
          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)

Procedure:
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


Summary:

          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("")
        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"
                   Response.Write(type)
          Case 1 : type = "Removable"
                   Response.Write(type)
          Case 2 : type = "Fixed"
                   Response.Write(type)
          Case 3 : type = "Network"
                   Response.Write(type)
          Case 4 : type = "CD-ROM"
                   Response.Write(type)
          Case 5 : type = "RAM Disk"
                   Response.Write(type)
      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
Next

4.    The Output will be as follows…..



Objects and Collections of FileSystemObject

Objects

         
  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.



  Drive
          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.


  File
          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.


  Folder
          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.



  TextStream
          Allows you to read and write text files.




Collections

  Drives
          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.



  Files
          Provides a list of all files contained within a folder.



  Folders
          Provides a list of all the folders within a Folder.

FileSystemObject

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


Advantages


  • 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.



Drawbacks


          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

ASP vs. ASP.NET



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


Parameters for Comparison
ASP
ASP.NET






Also Known as Classic ASP
Is enhanced version of ASP




1)
Application Environment
Is Interpreted
Is Compiled




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




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




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




5)
Technology used for Database Operations
 ADO
ADO.NET




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




7)
Separation of Code from Content
Not Possible
Is Possible




8)
Session and Application State Management Facility
Limited Access
Complete Access




9)
 Error handling system
Is Poor
Is Full Proof




10)
Deployment and Configuration
Difficult
Easy










All Rights Reserved. 2014 Copyright SIMPLITONA

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

Top