List Info

Thread: RE: Records being lost when binding to a repeater




RE: Records being lost when binding to a repeater
country flaguser name
United States
2007-07-25 08:55:47

I've never used Trace.Warn or Trace.axd.. I have used trace.write and no
errors occur. I also made session variables to see values. I can cleaerly
see with the trace on that the page in this case has 44 records... But since
it is under 50 for some reason it isn't showing any on the repeater control.

SQLstring

System.String

SELECT * FROM users WHERE(Not (userid Is NULL)) AND ([Gender] LIKE '%x%' OR
[Gender] = 'Female') And ([state] = 'PA') And ([country] = 'US') ORDER BY
LastVisit DESC

Searchlongitude

System.String

-79.541573

Searchlatitude

System.String

40.295383

Distance

System.String

38

IntUserCountTotal

System.Int32

44

pagedData.PageSize

System.Int32

50

TotalRecords

System.String

44

totalPages

System.Double

1

totalPagesToSearch

System.Double

0

As you can see the total records are 44 but the output is nothing to the
repeater. I have lowered the "pagedData.PageSize to 25 once and the records
show on the page. But then things lower don't show etc..... somehow it
seems in Sub doPaging() that the records aren't bound......

_____

From: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com
[mailto: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com] On Behalf Of Charles Carroll
Sent: Tuesday, July 24, 2007 10:07 PM
To: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com
Subject: Re: [AspNetAnyQuestionIsOk] Records being lost when binding to a
repeater

Why don't you use Trace.Write and Trace.Warn?

It can be combined with trace=true
trace.axd
and listeners to toggle seeing all this related data you need to see.

On 7/24/07, mbelcher <AspNetAnyQuestionIs
<mailto:AspNetAnyQuestionIsOk%40faroutcomputersystems.com>
Ok%40faroutcomputersystems.com">Okfaroutcomputersystems.com> wrote:
&gt;
>
>
&gt;
>
>
>; Heres the funny part. If the records are more than 50 which is the
> "pagedData.PageSize = 50" then they will show up in the output. If it is
> less than 50 nothing shows up. Records are being lost somehow as I see it
in
> the Sub doPaging() routine. I can see in the trace that it will show that
>; the right amount of rows etc exist when it gets to Sub doPaging() but then
>; some how they are not being bound or something as it doesn't seem to
output
> if under the pagedData.PageSize = 50 . any ideas..
>
> Function getTheData() As DataTable
>
&gt; Dim strSQLstring
>
> strSQLstring = Session(&quot;SQLstring")
>
&gt; 'Open the Connection -------------------------------------
>
> Dim objConn As SqlConnection
>
> Dim objConnString As String = "Data Source=localhost;Initial
> Catalog=dating;User Id=xxxxxxx;Password=xxxxxx;&quot;
>
> objConn = New SqlClient.SqlConnection(objConnString)
>
> objConn.Open()
>;
> 'NEW STUFF 5/1/2007 MBELCHER
>
>; Dim dt1 As New DataTable("users")
>
> Dim adapter As New SqlDataAdapter(strSQLstring, objConn)
>
>; adapter.Fill(dt1)
>
> 'Distance holder
&gt;
> Dim myDistance As Integer
>
> Dim Distance
>
>; Dim mySearchDistance 'user max distance
>
>; Dim IntCurrentRowUserID As Integer
>
> Dim strCurrentRowUser
&gt;
> Dim strCurrentRowCountry
>
&gt; Dim rowIndex As Integer
>
> rowIndex = dt1.Rows.Count
>
> 'DEBUG
&gt;
> Response.Write(";<b>USERS FOUND"; & " <BR><BR>&lt;/b>&quot;)
&gt;
> Dim IntUserCount As Integer
>
> Dim IntUserCountTotal As Integer
>
> IntUserCount = 0
>
> IntUserCountTotal = 0
>
> Response.Write(";<B> BEGINNING dt1.Rows.Count</b> = " &
&gt; dt1.Rows.Count & "<BR>";)
>
> For i As Integer = dt1.Rows.Count - 1 To 0 Step -1
>
> Dim row As DataRow = dt1.Rows(i)
>
> Session(&quot;Searchlongitude&quot;) = row("Longitude&quot;).ToString()
&gt;
> Session(&quot;Searchlatitude&quot;) = row("Latitude&quot;).ToString()
&gt;
> IntCurrentRowUserID = row("UserID";)
>
> 'DEBUG
&gt;
> IntUserCountTotal = IntUserCountTotal + 1
>
> Response.Write(row(&quot;username") & " " & IntUserCountTotal & "
&gt; <BR>")
&gt;
> strCurrentRowUser = row("username&quot;).ToString()
&gt;
> strCurrentRowCountry = row("country&quot;).ToString()
>;
> myDistance = Getdistance(Distance)
>
> mySearchDistance = Session(&quot;mySearchDistance&quot;)
&gt;
> If myDistance > mySearchDistance Then
>;
> If Not mySearchDistance = 9999999999 Then
>;
> Response.Write(";myDistance = " & myDistance & " and is >
>; " & mySearchDistance & " Need to remove <b>&quot; & strCurrentRowUser & "</b>
&gt; from search -- ")
>
> dt1.Rows.Remove(row)
>
&gt; Response.Write(";REMOVED: <b>&quot; & IntCurrentRowUserID &
&gt; "</b> With a rowIndex: <B>&quot; & rowIndex & "</b> <br>")
&gt;
> End If
>
> End If
>
> ' Add the distance to the current row
>
> row("Distance&quot;) = myDistance.ToString()
>
> 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
>; 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
>
>; If Not strCurrentRowCountry = "US&quot; Then
>;
> row("Distance&quot;) = "ooc&quot;
>;
> End If
>
> 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
>
>; Next
>;
> 'DEBUG
&gt;
> Response.Write(";<B> USER TOTAL </b> = " & IntUserCountTotal &
&gt; "<BR>";)
>
> Response.Write(";<B> END dt1.Rows.Count</b> = " & dt1.Rows.Count &
&gt; "<BR>";)
>
> Session(&quot;IntUserCountTotal") = IntUserCountTotal
&gt;
> Return (dt1)
&gt;
> 'Return dt1.Select("Distance < 100")
>
&gt; End Function
>
>; Sub doPaging()
>
&gt; 'New Code
>;
> Dim currentPage As Integer
>
> If Request.QueryString("page&quot;) = "&quot; Then
>;
> currentPage = 1
>
> Else
>;
> currentPage = Request.QueryString("page&quot;)
&gt;
> End If
>
> 'getRst(currentPage)
>
&gt; 'getPaging(currentPage)
>
> 'New Code
>;
> pagedData.DataSource = getTheData().DefaultView
>
> pagedData.AllowPaging = True
>;
> 'If Session(&quot;IntUserCountTotal") < 50 Then
>;
> ' pagedData.PageSize = Session(&quot;IntUserCountTotal")
&gt;
> 'Else
&gt;
> ' pagedData.PageSize = 50
>
> 'End If
>
> pagedData.PageSize = 50
>
> Session(&quot;pagedData.PageSize") = pagedData.PageSize
>
> 'New Code
>;
> Session(&quot;TotalRecords";) = pagedData.DataSourceCount.ToString()
&gt;
> If Session(&quot;TotalRecords";) Mod 10 = 0 Then
>;
> Session(&quot;totalPages") = Int(Session("TotalRecords&quot;) / 50)
>
> Else
>;
> Session(&quot;totalPages") = Int(Session("TotalRecords&quot;) / 50) + 1
>
> End If
>
> Dim i As Integer
>
> 'Dim pageTxt As String = "More Pages : &nbsp;&nbsp;&nbsp;&quot;
>;
> Dim pageTxt As String = "&quot;
>
> 'New Code
>;
> Try
>
> pagedData.CurrentPageIndex = Int32.Parse(currentPage).ToString()
&gt;
> Catch ex As Exception
>
&gt; pagedData.CurrentPageIndex = 0
>
> End Try
>
> btnPrev.Visible = (Not pagedData.IsFirstPage)
>
> btnNext.Visible = (Not pagedData.IsLastPage)
>
> btnPrevBottom.Visible = (Not pagedData.IsFirstPage)
>
> btnNextBottom.Visible = (Not pagedData.IsLastPage)
>
> 'New Code
>;
> Dim cPage As Integer
>
> cPage = pagedData.CurrentPageIndex
&gt;
> Session(&quot;totalPagesToSearch") = Session(&quot;totalPages")
>
&gt; Session(&quot;totalPagesToSearch") = Session(&quot;totalPagesToSearch") - 1
>
> For i = 1 To Session(&quot;totalPagesToSearch")
>
>; If cPage = i Then
>;
> pageTxt += "<b>" & i & "</b>&nbsp;"
>
&gt; Else
>;
> pageTxt += "<a href=Search-Distance5.aspx?page=" & i & ">" &
&gt; i & "</a>&nbsp;"
>
&gt; End If
>
> Next i
>
> PageNumberLinksTop.Text = pageTxt
>
> PageNumberLinksBottom.Text = pageTxt
>
> 'New Code
>;
> 'pageNumber.Text = (pagedData.CurrentPageIndex + 1) & " of " &
&gt; pagedData.PageCount
>
>; pageNumber.Text = (pagedData.CurrentPageIndex) & " of " &
&gt; pagedData.PageCount - 1
>
> 'pageNumberBottom.Text = (pagedData.CurrentPageIndex + 1) & " of " &
&gt; pagedData.PageCount
>
>; pageNumberBottom.Text = (pagedData.CurrentPageIndex) & " of " &
&gt; pagedData.PageCount - 1
>
> RepeaterListMembers.DataSource = pagedData
>
&gt; RepeaterListMembers.DataBind()
>
&gt; End Sub

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )