ASP.NET State Management: ASP.NET State Management: View State

Milan Negovan has written an article to provide an in-depth perspective on ViewState mechanism. In his article, he suggested some of the do’s and dont’s of using ViewState, for example, how simply disabling view state of the whole page can greatly enhance the performance of the page, if you just need to display a DataGrid on the page with no PostBack.

Link:
ASP.NET State Management: View State

I have seen many occasions that developers left EnableViewState true even if they just want to display a basic report page containing a grid control. This leads to the page to generate huge rendered payload for the ViewState.

ASP.NET 2.0, 1 Database Server, 1 IIS 6.0 Web Server and 32,000 Concurrent Connections!

Markus Frind has posted his experience of using ASP.NET 2.0 for one of largest dating site PlentyOfFish.com in Canada. In his post, Markus is telling how he has addressed concurrency issues by switching to ASP.NET 2.0:

At this point there were a lot of concurrency issues, the site would slooow down and just keep getting slower as more people came on. After switching to asp.net 2.0 all those problems went away. Now when there are over 32,000 concurrent connections at peak the site does not slow down. There are however still problems. I find that once you pass 100 Pageviews/second threads timers start to not get called for no reason.

Link:
Microsoft ASP.NET 2.0 Performance

He Interestingly didn’t use any kind of caching to render pages. Every page call actually pulls content from the database.

Checking all CheckBoxes in a GridView

Scott Mitchell has written another fantastic article on the simple and clean implementation of providing the check/uncheck all functionality in the GridView control.

Link: Checking All CheckBoxes in a GridView

The only thing his implementation missing in the article is placing CheckBox in the header of the GridView, and using it to toggle rows CheckBoxes. I made a small modification to the existing code to add this feature:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If Not Page.IsPostBack Then
        Dim dirInfo As New DirectoryInfo(Request.PhysicalApplicationPath)

        FileList.DataSource = dirInfo.GetFiles()
        FileList.DataBind()
    End If

    'On every page visit we need to build up the CheckBoxIDs array

    For Each gvr As GridViewRow In FileList.Rows
        'Get a programmatic reference to the CheckBox control

        Dim cb As CheckBox = CType(gvr.FindControl("RowLevelCheckBox"), CheckBox)

        ClientScript.RegisterArrayDeclaration("CheckBoxIDs", String.Concat("'", cb.ClientID, "'"))
    Next

    '--modified code

    Dim checkAll As New CheckBox()
    checkAll.Text = ""
    checkAll.ID = "checkAll"
    checkAll.Attributes.Add("onclick", "ChangeAllCheckBoxStates(this.checked);")
    FileList.HeaderRow.Cells(0).Controls.Add(checkAll)

End Sub