Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Optimizing Html Code

Optimizing Html Code

Scheduled Pinned Locked Moved ASP.NET
questionhtmlcode-review
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Syed Ali Raza
    wrote on last edited by
    #1

    Hi All How can i optimize the HTML through Code.I want to reduce the page size and unnecessary tags. Does any know the way or have suggestion?

    W S M N 4 Replies Last reply
    0
    • S Syed Ali Raza

      Hi All How can i optimize the HTML through Code.I want to reduce the page size and unnecessary tags. Does any know the way or have suggestion?

      W Offline
      W Offline
      whatUrunning com
      wrote on last edited by
      #2

      It really depends on the type of data you are displaying and the controls you are using but it may be possible to use a Repeater control instead of a GridView control for instance. Also, instead of setting properties on all off the controls for width, color etc, use CSS classes for all styling. Disable ViewState where you can, this can add significantly to page size.

      www.whatUrunning.com

      1 Reply Last reply
      0
      • S Syed Ali Raza

        Hi All How can i optimize the HTML through Code.I want to reduce the page size and unnecessary tags. Does any know the way or have suggestion?

        S Offline
        S Offline
        Syed Ali Raza
        wrote on last edited by
        #3

        Thanks to reply. Is there any way to directly optimize the html in aspx pages. because first i have to save that aspx page into html then I can try to revomove unnecessary code.

        1 Reply Last reply
        0
        • S Syed Ali Raza

          Hi All How can i optimize the HTML through Code.I want to reduce the page size and unnecessary tags. Does any know the way or have suggestion?

          M Offline
          M Offline
          Mark Churchill
          wrote on last edited by
          #4

          If you are having issues with the size of pages, then check if you are abusing the ViewState by putting too much junk into it. You can turn use of the ViewState off on controls that don't need to track state. If its just your markup thats getting too big, either redesign your pages or switch on HTTP compression. :P

          Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
          Alpha release: Entanglar: Transparant multiplayer framework for .Net games.

          1 Reply Last reply
          0
          • S Syed Ali Raza

            Hi All How can i optimize the HTML through Code.I want to reduce the page size and unnecessary tags. Does any know the way or have suggestion?

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            Syed Ali Raza wrote:

            How can i optimize the HTML through Code

            There are many methods. I believe CP has some excellent articles on this subject. Try doing a search. I'd suggest the following 1 - Disable viewstate if it is not required 2 - Implement lazy loading kind of stuff using AJAX. So you won't load unnecessary data on page load, 3 - Don't use tables for page outlining. If you are using, make it small. Don't wrap whole content in one table. Browsers can render the content only after getting the end element. So wrapping the whole content in a single table will make rendering slow. 4 - Don't use DataGrid/GridView unnecessarily. Try with some lightweight controls like repeater. many more..

            Navaneeth How to use google | Ask smart questions

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups