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-27 07:42:29

pagedData.CurrentPageIndex is the reason. I had to start it at 0 as this was
where the records were if it was less than one full page of 50. Now there is
just a page 0 to begin with. Not sure how I could make it so that it doesn't
use the 0 position and just starts putting the beginning records on page
1.....

_____

From: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com
[mailto: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com] On Behalf Of mbelcher
Sent: Wednesday, July 25, 2007 3:57 PM
To: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com
Subject: RE: [AspNetAnyQuestionIsOk] Records being lost when binding to a
repeater

I have actually commented that out in the getthedata before. It only removes
rows if distance is in the criteria which it isn't at the moment. In the
Sub doPaging() which is after getthedata is ran there is a line that will
assign a session variable with the amount of records returned.

Session("TotalRecords") = pagedData.DataSourceCount.ToString()

it will clearly have a value of 44. Also in the page output I have some test
response.write to output the users found and 44 are printed out in the upper
left hand corner of the page. But for some reason at the end when it binds
the repeater control will not show them. Then just to see what would happen
once I changed pagedData.PageSize = 50 to pagedData.PageSize = 25 and the
repeater showed the records. Makes no sense. I wish html was on with this
email group so you could read it more. I can send to you regular mail if it
will come through clearer. I can also just make a aspgroup account and you
can runt he page yourself and read the values.

_____

From: AspNetAnyQuestionIs <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
Ok%40yahoogroups.com">Okyahoogroups.com
[mailto:AspNetAnyQuestionIs <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
Ok%40yahoogroups.com">Okyahoogroups.com] On Behalf Of Peter Brunone
Sent: Wednesday, July 25, 2007 3:37 PM
To: AspNetAnyQuestionIs <mailto:AspNetAnyQuestionIsOk%40yahoogroups.com&gt;
Ok%40yahoogroups.com">Okyahoogroups.com
Subject: Re: [AspNetAnyQuestionIsOk] Records being lost when binding to a
repeater

I'm a bit confused here. There's too much code (formatted by email) for me
to study without going cross-eyed, but it looks like in getTheData, you're
removing all the rows from the DataTable.

On 7/24/07, mbelcher <AspNetAnyQuestionIs
<mailto:AspNetAnyQuestionIsOk%40faroutcomputersystems.com>
Okfaroutcomputersy <mailto:Ok%40faroutcomputersystems.com> stems.com&gt;
wrote:
>
> 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
&gt; 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]

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

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

__._,_.___
.

__,_._,___
[1]

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