.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 1st, 2003, 09:01 PM
joephoenix joephoenix is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 26 joephoenix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Displaying record # for each record in a datalist

I’ve got a working datalist going; the only thing is that I can’t seem to display properly the record number for each record. I’m trying to use a For...Next loop within an If Not Page.IsPostBack and I keep getting an error. Here is my code.<br><div class="msgQuoteWrap"><div class="msgCode"><br> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br> If Not Page.IsPostBack() Then<br> lblPageSize.Text = "5"<br> lblCurrIndex.Text = "0"<br> SQLBind()<br> End If<br> End Sub<br><br> Private Sub SQLBind()<br> Dim objConn As New SqlConnection("Server=SQLSALESDEV;Database=users;UID=u87594;Passw ord=afton;")<br> Dim objDA As New SqlDataAdapter("SELECT contactID_pk, name, message, dateCreated FROM contactUs", objConn)<br> Dim objDS As New DataSet()<br><br> If Not Page.IsPostBack() Then<br> Dim intCounter As Integer 'Holds counter for loop<br> Dim intNewCounter As Integer = 1<br> objDA.Fill(objDS)<br> lblRecordCount.Text = CStr(objDS.Tables(0).Rows.Count)<br><br> 'My record counter loop<br> For intCounter = 0 To objDS.Tables(0).Rows.Count - 1<br> lblFrIntCounter.Text = lblFrIntCounter.Text & intNewCounter.ToString<br> intNewCounter += 1<br> Next<br> objDS = Nothing<br> objDS = New DataSet()<br> End If<br><br> objDA.Fill(objDS, CInt(lblCurrIndex.Text), CInt(lblPageSize.Text), "contactUs")<br> dblDisplay.DataSource = objDS.Tables(0).DefaultView<br> dblDisplay.DataBind()<br> objConn.Close()<br> PrintStatus()<br> End Sub<br></div></div><br>What’s the matter with what I’m doing?

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Displaying record # for each record in a datalist


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT