Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid Not Showing Top Record 1

Status
Not open for further replies.

sila

Technical User
Aug 8, 2003
76
GB
Hi
I have a datagrid using a datareader to populate it. On running it the top record seems to be cut off each time in all cases. The stored procedure behind it is showing all records correctly?

Any ideas greatly appreciated.

Sila.
 
On running it the top record seems to be cut off each time in all cases
What do you mean "cut off"?

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
It doesnt actually show the first record that I know show should be there from the stored procedure output.
 
IS it maybe confusing the first row with a Header row?

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
post how you bind your datagrid...

"...we both know I'm training to become a cagefigher...see what happens if you try 'n hit me..."
 
DistrictID = Me.Request.QueryString("id")
ElecID = Session("ElecID")
Me.SqlComm_SelectDivList.Parameters("@DistrictID").Value = DistrictID
Me.SqlComm_SelectDivList.Parameters("@ElecID").Value = ElecID
Me.SqlConnection1.Open()
dtrDivisionList = Me.SqlComm_SelectDivList.ExecuteReader
If dtrDistrict.Read Then
Session("DisName") = dtrDivisionList("DisName")
End If
Me.DataGrid1.DataSource = dtrDivisionList
Me.DataGrid1.DataBind()
dtrDivisionList.Close()
Me.SqlConnection1.Close()
 
Just as a side point why do you do the following if it is returning more than one record:
Code:
        If dtrDistrict.Read Then
            Session("DisName") = dtrDivisionList("DisName")
        End If
That will just overwrite the session variable each time.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
I just removed....

If dtrDistrict.Read Then
Session("DisName") = dtrDivisionList("DisName")
End If

and its now showing the top row or the datagrid.

Thanks!

Sila
 
Code:
If dtrDistrict.Read Then
   Session("DisName") = dtrDivisionList("DisName")
End If

could this section be calling the first record, then by the time you bind it, you're at the second record already?


"...we both know I'm training to become a cagefigher...see what happens if you try 'n hit me..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top