Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 20th, 2005, 04:46 AM
Authorized User
 
Join Date: Nov 2004
Location: Indore, MP, India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to avanishp
Default page take time to load after adding rows in table

Hi all

I have created one html table run at server dynamically by adding rows one by one, my problem is if I add 400-500 rows in this table, it doesn;t take time in adding rows, but after adding it takes time to show page (it shows blank screen some times and thes show page), I am not getting how I can improve that.

Thanks
Avanish

__________________
Avanish Pandey
Set your heart upon your work, but never on its reward
Reply With Quote
  #2 (permalink)  
Old June 20th, 2005, 08:10 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Usually the time consumed by the actual program is minimal compared to the time it takes to transfer the HTML from the server to the browser. The only way to speed up this process is to reduce the amount of HTML by reducing the number of rows (can you use paging) or by streamlining what you do send (investigate what's getting into viewstate, it could be unnecessarily large). If you can't reduce the HTML you have to live with the delay.

-Peter
Reply With Quote
  #3 (permalink)  
Old June 20th, 2005, 09:54 AM
Authorized User
 
Join Date: Nov 2004
Location: Indore, MP, India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to avanishp
Default

Hi Peter

Thanks for reply.

I can;t reduce HTML, and paging is not possible bcos this data if for single page.
Also I had created a xml string for whole and tried to show it with xslt, but I didn;t found any performance improvement.


Avanish
Reply With Quote
  #4 (permalink)  
Old June 20th, 2005, 12:11 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Can you show us your code?

There might be ways to optimize things, although I agree with Peter that paging and reducing the Html is probably the best way to speed things up....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old June 21st, 2005, 10:10 AM
Authorized User
 
Join Date: Nov 2004
Location: Indore, MP, India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to avanishp
Default

My code has nothing special, just getting data from different tables of dataset, get row one by one from one table and do some check and show it on html table:


Dim script As String
            script = "<Script language='javascript'>mypage=window.open('waiting. htm','newwin','toolbar=no, height=150, width=250');</script>"
            RegisterClientScriptBlock("KEY", script)
            ' Response.Flush()
            Dim tr As New HtmlTableRow
            Dim td As New HtmlTableCell
            td.BgColor = "#f4f9fe"
            td.ColSpan = 2
            tr.Cells.Add(td)
            Dim dsLocation As New DataSet
            If MemFilter.FilterLocation = "" Then
                dsLocation.ReadXml(Server.MapPath("xmldata/location.xml"))
            Else
                Dim dtLocation As New DataTable
                Dim dtColumn As New DataColumn
                dtColumn.ColumnName = "Location"
                dtLocation.Columns.Add(dtColumn)
                Dim DrLocation As DataRow = dtLocation.NewRow()
                DrLocation.Item(0) = MemFilter.FilterLocation
                dtLocation.Rows.Add(DrLocation)
                dsLocation.Tables.Add(dtLocation)
            End If
            Dim dsGroup As New DataSet
            If MemFilter.FilterGroup = "" Then
                dsGroup.ReadXml(Server.MapPath("xmldata/Groups.xml"))
            Else
                Dim dtGroup As New DataTable
                Dim dtColumn As New DataColumn
                dtColumn.ColumnName = "Group"
                dtGroup.Columns.Add(dtColumn)
                Dim DrGroup As DataRow = dtGroup.NewRow()
                DrGroup.Item(0) = MemFilter.FilterGroup
                dtGroup.Rows.Add(DrGroup)
                dsGroup.Tables.Add(dtGroup)
            End If

            Dim j As Integer
            Dim LocationCount As Integer = dsLocation.Tables(0).Rows.Count
            Dim GroupsCount As Integer = dsGroup.Tables(0).Rows.Count
            For j = 0 To LocationCount - 1
                AddTableCell(tr, "<b>" + dsLocation.Tables(0).Rows(j).Item(0) + "</b>", "Center", "#6487dc", 6)
            Next

            ReportTable.Rows.Add(tr)
            Dim oConn As SqlClient.SqlConnection = OpenDataConnection()
            Dim dsReportData As DataSet = GetDataSet("GetSurveyStatisticsDataForDetailReport '" & Survey_ID & "','" & MemFilter.FilterLocation & "','" & MemFilter.FilterGroup & "','" & MemFilter.FilterStartDate & "','" & MemFilter.FilterEndDate & "','" & MemFilter.FilterMemType1 & "','" & MemFilter.FilterMemType2 & "'", oConn)


            If Not IsNothing(dsReportData) Then


                If dsReportData.Tables(0).Rows.Count > 0 Then


                    For j = 0 To dsReportData.Tables(0).Rows.Count - 1
                        Dim trMat As New HtmlTableRow
                        trMat.BgColor = "#c7d8fa"
                        AddTableCell(trMat, "<b>" & GetSectionName(Survey_ID, dsReportData.Tables(0).Rows(j).Item(0), oConn) & "</b>", "#0148b2")
                        AddTableCell(trMat, "Group")
                        Dim k As Integer
                        For k = 0 To LocationCount - 1
                            AddTableCell(trMat, "Total")
                            AddTableCell(trMat, "1")
                            AddTableCell(trMat, "2")
                            AddTableCell(trMat, "3")
                            AddTableCell(trMat, "4")
                            AddTableCell(trMat, "5")

                        Next

                        ReportTable.Rows.Add(trMat)

                        Dim icount As Integer
                        Dim drows As DataRow() = dsReportData.Tables(1).Select("Question_ID=" & dsReportData.Tables(0).Rows(j).Item(0))

                        Dim dcols As DataRow() = dsReportData.Tables(3).Select("Question_ID=" & dsReportData.Tables(0).Rows(j).Item(0))

                        For icount = 0 To drows.Length - 1
                            trMat = New HtmlTableRow
                            trMat.BgColor = "#f4f9fe"
                            AddTableCell(trMat, drows(icount).Item(1), GroupsCount, 1)
                            Dim GCounter As Integer
                            Dim ColScoreTotal(LocationCount) As Integer
                            Dim ColPossibleTotal(LocationCount) As Integer
                            For GCounter = 0 To GroupsCount - 1
                                If GCounter <> 0 Then
                                    trMat = New HtmlTableRow
                                    trMat.BgColor = "#f4f9fe"
                                End If
                                AddTableCell(trMat, dsGroup.Tables(0).Rows(GCounter).Item(0))
                                Dim LCounter As Integer
                                Dim ScoreTotal As Integer = 0
                                Dim PossibleTotal As Integer = 0



                                For LCounter = 0 To LocationCount - 1
                                    Dim ColCount As Integer

                                    Dim ColArr As New ArrayList(dcols.Length)
                                    Dim Total As Integer = 0
                                    For ColCount = 0 To dcols.Length - 1
                                        Dim ScoreRows As DataRow() = dsReportData.Tables(2).Select("rowid=" & drows(icount).Item(0) & " and columnid=" & dcols(ColCount).Item(0) & " and Company_name='" & dsGroup.Tables(0).Rows(GCounter).Item(0) & "' and Location='" & dsLocation.Tables(0).Rows(LCounter).Item(0) & "'", "columnid")
                                        If ScoreRows.Length > 0 Then
                                            ColArr.Add(ScoreRows(0).Item(0))
                                            Total += ScoreRows(0).Item(0)
                                            'AddTableCell(trMat, ScoreRows(0).Item(0))
                                        Else
                                            ColArr.Add("0")
                                            ' AddTableCell(trMat, "0")
                                        End If
                                    Next
                                    AddTableCell(trMat, Total)
                                    For ColCount = 0 To dcols.Length - 1
                                        AddTableCell(trMat, ColArr(ColCount))
                                    Next


                                ReportTable.Rows.Add(trMat)
                            Next


                        Next


                    Next



                End If


            End If

            script = "<script language='javascript'>mypage.close();</script>"
            RegisterStartupScript("mykey", script)

Reply With Quote
  #6 (permalink)  
Old June 21st, 2005, 02:32 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Why are you manually creating the layout for the data?

Can't you use one of the .NET data controls and use databinding instead?

That might speed things up...

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
keep adding table rows on button click wlin ASP.NET 2.0 Basics 0 September 26th, 2006 02:14 PM
Adding new field to a database table in run time dotnet cat ASP.NET 1.0 and 1.1 Basics 1 October 6th, 2005 01:36 PM
Inserting mulitible rows in one table at one time mohanrajb Classic ASP Databases 1 June 21st, 2005 10:09 AM
Adding rows to a table in ASP.NET codebehind GilletteCat ASP.NET 1.0 and 1.1 Professional 2 August 3rd, 2004 02:56 PM
Adding new table on page dungey Javascript 2 February 20th, 2004 07:11 AM



All times are GMT -4. The time now is 07:03 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.