DataList Problem

Author Message
Mindmesh

  • Total Posts : 78
  • Scores: 0
  • Reward points : 0
  • Joined: 11/23/2004
  • Location:
  • Status: offline
DataList Problem Thursday, December 08, 2005 5:54 AM (permalink)
0
 When I try to compile this code:
 
   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          'Get data from the data tier
          If Not IsPostBack Then
              Dim dsVehicles As DataSet
              Dim objData As New CarsData
  
              dsVehicles = objData.getVehicles
              Session("DataSet") = dsVehicles
              dlVehicles.DataSource = dsVehicles
              Me.DataBind()
          End If
  
 
      End Sub
  
  Public Function getVehicles() As DataSet
          daVehicles.Fill(DsVehicles1)
          Return DsVehicles1
      End Function
  

I get the following error:

Exception Details: System.IndexOutOfRangeException: Index 0 is not non-negative and below total rows count.

Source Error:


Line 16: runat="server">
Line 17: <ItemTemplate>
Line 18: <asp:LinkButton id=btnManuf runat="server" Text='<%# DataBinder.Eval(DsVehicles, "Tables[Vehicle].DefaultView.[0].Manuf_Name") %>'>
Line 19: </asp:LinkButton>
Line 20:<asp:LinkButton id=btnModel runat="server" Text='<%# DataBinder.Eval(DsVehicles, "Tables[Vehicle].DefaultView.[0].Model") %>'>

Any idea what may be causing this issue? Thanks.
 
#1
    Snipah

    • Total Posts : 1339
    • Scores: 8
    • Reward points : 0
    • Joined: 11/1/2004
    • Location: Scotland
    • Status: offline
    RE: DataList Problem Thursday, December 08, 2005 10:13 AM (permalink)
    0
    Hiya,
     
    I found the following through Google:
     
    http://www.webdeveloper.com/forum/archive/index.php/t-47166.html
     
    Please review...
    For more information, please see the "Read me First" topic.

    http://www.visualbasicscript.com
     
    #2
      Mindmesh

      • Total Posts : 78
      • Scores: 0
      • Reward points : 0
      • Joined: 11/23/2004
      • Location:
      • Status: offline
      RE: DataList Problem Thursday, December 08, 2005 11:40 AM (permalink)
      0
      Snipah thanks for the help, but I already had the fill statement. This is a tough one.. Sad part is I don't know if my teacher knows enough about VB to help me fix it. ;o)
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9