gridview with blank rows

Discussion in 'ASP .Net Datagrid Control' started by eagle, Jun 27, 2007.

  1. eagle

    eagle Guest

    I have a gridview that I am binding dynamically, and the gridview does have
    records in it but they are all blank except for the "Select". What am I
    missing:

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true">
    </asp:GridView>



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Handles Me.Load
    Try
    Call BindGrid
    catch ex as exception
    Message.innerhtml = "Error!"
    end try
    End Sub
    private Sub BindGrid
    Dim bError as Boolean
    Dim ds as data.dataset = nothing
    Dim qry as String
    qry = "myStoredProcedure"
    ds = _BL.GetDataSet(qry, bError)

    gridview1.DataSource = ds
    gridview1.DataBind

    End Sub

    Public Function GetDataSet(ByVal qry As String, Optional ByRef bError as
    Boolean=False) As Dataset

    Try
    Dim ds as New Data.dataset
    ds = _DL.GetDataSet(qry, bError)
    If bError = False
    return ds
    else
    return nothing
    End If
    Catch ex As Exception
    Throw New Exception("GetDataSet Error: " & ex.Message)
    End Try
    End Function

    Public Function GetDataSet(ByVal qry As String, Optional ByRef boolError
    as Boolean=False) As Dataset

    boolError = False
    Dim t(0) as string
    t(0) = "myTable"

    Dim ds as new DataSet
    Try
    SqlDataAccess.FillDataset(_sSQLConn, CommandType.text, qry, ds,
    t)
    If ds.Tables.Count = 0 then
    Throw new exception("No data found")
    else
    Dim dt As DataTable = ds.Tables(0)
    If dt.Rows.Count = 0 Then
    Throw new exception("No data found")
    End If
    Return ds
    end if
    Catch ex as Exception
    Throw new exception("No data found")
    Exit Try
    Finally
    ds.Dispose()
    ds = Nothing
    End Try
    Return nothing
    End Function
     
    eagle, Jun 27, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MC
    Replies:
    2
    Views:
    8,296
  2. Drew
    Replies:
    2
    Views:
    332
    John Machin
    Apr 25, 2007
  3. Drew
    Replies:
    1
    Views:
    297
    Michael Bentley
    Apr 24, 2007
  4. VijayRama
    Replies:
    2
    Views:
    2,355
    Gregory A. Beamer
    Oct 12, 2009
  5. eagle

    Blank rows

    eagle, Jul 22, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    993
    eagle
    Jul 22, 2007
Loading...

Share This Page