How do i debug a datagrid problem ?

Discussion in 'ASP .Net Datagrid Control' started by Tony Girgenti, Sep 28, 2006.

  1. Hello.

    I'm developing and testing a web application using VS.NET 2003, VB, .NET
    Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
    computer. I'm using a web form.

    I'm trying to display a datagrid on my web form using this code:
    Me.tripsDataGrid.DataSource = Me.tripsDataSet
    Me.tripsDataGrid.DataMember =
    Me.tripsDataSet.tripsTable.ToString
    Me.tripsDataGrid.DataBind()

    It displays the DataGrid on the form with the column headers but no data
    rows. The data is in the tripsTable rows because i can display them in the
    debugger.

    How do i debug this to figure out why it is not populating the datagrid ?

    Any help would be gratefully appreciated.

    Thanks,
    Tony
     
    Tony Girgenti, Sep 28, 2006
    #1
    1. Advertising

  2. Tony Girgenti

    Brian Foree Guest

    I don't know if this would make a difference, but everything looks OK in
    your code with the possible exception of the following line:

    Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString

    I'd suggest replacing the right side of the expression with the name of the
    table as a String, like so (I'm guessing at the name of the table within
    your DataSet):

    Me.tripsDataGrid.DataMember = "trips"

    The reason I'm suggesting this is because I seem to remember a similar
    problem that was related to the DataMember being set incorrectly.

    You could also set a breakpoint on this line (without the modification), run
    the app in Debug mode and see what "Me.tripsDataSet.tripsTable.ToString"
    evaluates to at that point. I did notice that the ToString method of a
    System.Data.DataTable returns "the TableName and DisplayExpression, if there
    is one as a concatenated string", so one possibility is that there is a
    DisplayExpression, which would cause problems when you assign the
    DataMember.

    If my suggestion works and you still want to assign the DataMember
    dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which
    contains just the name of the table as a String.

    "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    news:...
    > Hello.
    >
    > I'm developing and testing a web application using VS.NET 2003, VB, .NET
    > Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
    > computer. I'm using a web form.
    >
    > I'm trying to display a datagrid on my web form using this code:
    > Me.tripsDataGrid.DataSource = Me.tripsDataSet
    > Me.tripsDataGrid.DataMember =
    > Me.tripsDataSet.tripsTable.ToString
    > Me.tripsDataGrid.DataBind()
    >
    > It displays the DataGrid on the form with the column headers but no data
    > rows. The data is in the tripsTable rows because i can display them in
    > the debugger.
    >
    > How do i debug this to figure out why it is not populating the datagrid ?
    >
    > Any help would be gratefully appreciated.
    >
    > Thanks,
    > Tony
    >
     
    Brian Foree, Sep 28, 2006
    #2
    1. Advertising

  3. Hello Brian.

    I tried all of your suggestions and nothing worked. However, i did notice
    that the line "Me.tripsDataSet.tripsTable.TableName" does yield the correct
    table name, so i will probably stay with that in my coding.

    All i need to do now is figure out why the grid is empty.

    Thanks,
    Tony

    "Brian Foree" <> wrote in message
    news:...
    >I don't know if this would make a difference, but everything looks OK in
    >your code with the possible exception of the following line:
    >
    > Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString
    >
    > I'd suggest replacing the right side of the expression with the name of
    > the table as a String, like so (I'm guessing at the name of the table
    > within your DataSet):
    >
    > Me.tripsDataGrid.DataMember = "trips"
    >
    > The reason I'm suggesting this is because I seem to remember a similar
    > problem that was related to the DataMember being set incorrectly.
    >
    > You could also set a breakpoint on this line (without the modification),
    > run the app in Debug mode and see what
    > "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did
    > notice that the ToString method of a System.Data.DataTable returns "the
    > TableName and DisplayExpression, if there is one as a concatenated
    > string", so one possibility is that there is a DisplayExpression, which
    > would cause problems when you assign the DataMember.
    >
    > If my suggestion works and you still want to assign the DataMember
    > dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which
    > contains just the name of the table as a String.
    >
    > "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    > news:...
    >> Hello.
    >>
    >> I'm developing and testing a web application using VS.NET 2003, VB, .NET
    >> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
    >> computer. I'm using a web form.
    >>
    >> I'm trying to display a datagrid on my web form using this code:
    >> Me.tripsDataGrid.DataSource = Me.tripsDataSet
    >> Me.tripsDataGrid.DataMember =
    >> Me.tripsDataSet.tripsTable.ToString
    >> Me.tripsDataGrid.DataBind()
    >>
    >> It displays the DataGrid on the form with the column headers but no data
    >> rows. The data is in the tripsTable rows because i can display them in
    >> the debugger.
    >>
    >> How do i debug this to figure out why it is not populating the datagrid ?
    >>
    >> Any help would be gratefully appreciated.
    >>
    >> Thanks,
    >> Tony
    >>

    >
    >
     
    Tony Girgenti, Sep 28, 2006
    #3
  4. Tony Girgenti

    Brian Foree Guest

    Are you loading the data into the table before you call the DataGrid's
    DataBind method? I know you said that the data is in the tripsTable rows
    because you can display them in the debugger, but did you check that just
    before the DataBind call?

    "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    news:...
    > Hello Brian.
    >
    > I tried all of your suggestions and nothing worked. However, i did notice
    > that the line "Me.tripsDataSet.tripsTable.TableName" does yield the
    > correct table name, so i will probably stay with that in my coding.
    >
    > All i need to do now is figure out why the grid is empty.
    >
    > Thanks,
    > Tony
    >
    > "Brian Foree" <> wrote in message
    > news:...
    >>I don't know if this would make a difference, but everything looks OK in
    >>your code with the possible exception of the following line:
    >>
    >> Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString
    >>
    >> I'd suggest replacing the right side of the expression with the name of
    >> the table as a String, like so (I'm guessing at the name of the table
    >> within your DataSet):
    >>
    >> Me.tripsDataGrid.DataMember = "trips"
    >>
    >> The reason I'm suggesting this is because I seem to remember a similar
    >> problem that was related to the DataMember being set incorrectly.
    >>
    >> You could also set a breakpoint on this line (without the modification),
    >> run the app in Debug mode and see what
    >> "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did
    >> notice that the ToString method of a System.Data.DataTable returns "the
    >> TableName and DisplayExpression, if there is one as a concatenated
    >> string", so one possibility is that there is a DisplayExpression, which
    >> would cause problems when you assign the DataMember.
    >>
    >> If my suggestion works and you still want to assign the DataMember
    >> dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which
    >> contains just the name of the table as a String.
    >>
    >> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    >> news:...
    >>> Hello.
    >>>
    >>> I'm developing and testing a web application using VS.NET 2003, VB, .NET
    >>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
    >>> computer. I'm using a web form.
    >>>
    >>> I'm trying to display a datagrid on my web form using this code:
    >>> Me.tripsDataGrid.DataSource = Me.tripsDataSet
    >>> Me.tripsDataGrid.DataMember =
    >>> Me.tripsDataSet.tripsTable.ToString
    >>> Me.tripsDataGrid.DataBind()
    >>>
    >>> It displays the DataGrid on the form with the column headers but no data
    >>> rows. The data is in the tripsTable rows because i can display them in
    >>> the debugger.
    >>>
    >>> How do i debug this to figure out why it is not populating the datagrid
    >>> ?
    >>>
    >>> Any help would be gratefully appreciated.
    >>>
    >>> Thanks,
    >>> Tony
    >>>

    >>
    >>

    >
    >
     
    Brian Foree, Sep 28, 2006
    #4
  5. Brian.

    Yes. I just checked it again. Very strange. When i use this statement:
    Me.tripsDataGrid.DataSource = Me.tripsDataSet

    It display the empty grid with the column name across the top.

    If i use this statement:
    Me.tripsDataGrid.DataSource = Me.tripsDataSet.DataSetName

    It displays the grid with one column named "Item" and puts the name of the
    dataset under it one letter at a time like this:
    t
    r
    i
    p
    s
    D
    S

    Thanks,
    Tony

    "Brian Foree" <> wrote in message
    news:...
    > Are you loading the data into the table before you call the DataGrid's
    > DataBind method? I know you said that the data is in the tripsTable rows
    > because you can display them in the debugger, but did you check that just
    > before the DataBind call?
    >
    > "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    > news:...
    >> Hello Brian.
    >>
    >> I tried all of your suggestions and nothing worked. However, i did
    >> notice that the line "Me.tripsDataSet.tripsTable.TableName" does yield
    >> the correct table name, so i will probably stay with that in my coding.
    >>
    >> All i need to do now is figure out why the grid is empty.
    >>
    >> Thanks,
    >> Tony
    >>
    >> "Brian Foree" <> wrote in message
    >> news:...
    >>>I don't know if this would make a difference, but everything looks OK in
    >>>your code with the possible exception of the following line:
    >>>
    >>> Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString
    >>>
    >>> I'd suggest replacing the right side of the expression with the name of
    >>> the table as a String, like so (I'm guessing at the name of the table
    >>> within your DataSet):
    >>>
    >>> Me.tripsDataGrid.DataMember = "trips"
    >>>
    >>> The reason I'm suggesting this is because I seem to remember a similar
    >>> problem that was related to the DataMember being set incorrectly.
    >>>
    >>> You could also set a breakpoint on this line (without the modification),
    >>> run the app in Debug mode and see what
    >>> "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did
    >>> notice that the ToString method of a System.Data.DataTable returns "the
    >>> TableName and DisplayExpression, if there is one as a concatenated
    >>> string", so one possibility is that there is a DisplayExpression, which
    >>> would cause problems when you assign the DataMember.
    >>>
    >>> If my suggestion works and you still want to assign the DataMember
    >>> dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which
    >>> contains just the name of the table as a String.
    >>>
    >>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    >>> news:...
    >>>> Hello.
    >>>>
    >>>> I'm developing and testing a web application using VS.NET 2003, VB,
    >>>> .NET
    >>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
    >>>> computer. I'm using a web form.
    >>>>
    >>>> I'm trying to display a datagrid on my web form using this code:
    >>>> Me.tripsDataGrid.DataSource = Me.tripsDataSet
    >>>> Me.tripsDataGrid.DataMember =
    >>>> Me.tripsDataSet.tripsTable.ToString
    >>>> Me.tripsDataGrid.DataBind()
    >>>>
    >>>> It displays the DataGrid on the form with the column headers but no
    >>>> data rows. The data is in the tripsTable rows because i can display
    >>>> them in the debugger.
    >>>>
    >>>> How do i debug this to figure out why it is not populating the datagrid
    >>>> ?
    >>>>
    >>>> Any help would be gratefully appreciated.
    >>>>
    >>>> Thanks,
    >>>> Tony
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Tony Girgenti, Sep 29, 2006
    #5
  6. Hello Brian.

    I deleted all my data controls and started over and created a new datagrid.
    Now the grid displays on my web form filled with sample data, which is
    something it was not doing before. I also noticed that it allows me to use
    the property page for the datagrid to select the DataSource and DataMember
    properties in the dropdown list fashion, another thing it was not doing
    before.

    But i'm still having the same problem. It displays the Datagrid headings
    but not the data from the typed dataset. I also tried assigning the
    datasource and datamemeber dynamically.

    Do you have any other ideas of what to try ?

    Thanks,
    Tony

    "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    news:...
    > Brian.
    >
    > Yes. I just checked it again. Very strange. When i use this statement:
    > Me.tripsDataGrid.DataSource = Me.tripsDataSet
    >
    > It display the empty grid with the column name across the top.
    >
    > If i use this statement:
    > Me.tripsDataGrid.DataSource = Me.tripsDataSet.DataSetName
    >
    > It displays the grid with one column named "Item" and puts the name of the
    > dataset under it one letter at a time like this:
    > t
    > r
    > i
    > p
    > s
    > D
    > S
    >
    > Thanks,
    > Tony
    >
    > "Brian Foree" <> wrote in message
    > news:...
    >> Are you loading the data into the table before you call the DataGrid's
    >> DataBind method? I know you said that the data is in the tripsTable rows
    >> because you can display them in the debugger, but did you check that just
    >> before the DataBind call?
    >>
    >> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    >> news:...
    >>> Hello Brian.
    >>>
    >>> I tried all of your suggestions and nothing worked. However, i did
    >>> notice that the line "Me.tripsDataSet.tripsTable.TableName" does yield
    >>> the correct table name, so i will probably stay with that in my coding.
    >>>
    >>> All i need to do now is figure out why the grid is empty.
    >>>
    >>> Thanks,
    >>> Tony
    >>>
    >>> "Brian Foree" <> wrote in message
    >>> news:...
    >>>>I don't know if this would make a difference, but everything looks OK in
    >>>>your code with the possible exception of the following line:
    >>>>
    >>>> Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString
    >>>>
    >>>> I'd suggest replacing the right side of the expression with the name of
    >>>> the table as a String, like so (I'm guessing at the name of the table
    >>>> within your DataSet):
    >>>>
    >>>> Me.tripsDataGrid.DataMember = "trips"
    >>>>
    >>>> The reason I'm suggesting this is because I seem to remember a similar
    >>>> problem that was related to the DataMember being set incorrectly.
    >>>>
    >>>> You could also set a breakpoint on this line (without the
    >>>> modification), run the app in Debug mode and see what
    >>>> "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did
    >>>> notice that the ToString method of a System.Data.DataTable returns "the
    >>>> TableName and DisplayExpression, if there is one as a concatenated
    >>>> string", so one possibility is that there is a DisplayExpression, which
    >>>> would cause problems when you assign the DataMember.
    >>>>
    >>>> If my suggestion works and you still want to assign the DataMember
    >>>> dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which
    >>>> contains just the name of the table as a String.
    >>>>
    >>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
    >>>> news:...
    >>>>> Hello.
    >>>>>
    >>>>> I'm developing and testing a web application using VS.NET 2003, VB,
    >>>>> .NET
    >>>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
    >>>>> computer. I'm using a web form.
    >>>>>
    >>>>> I'm trying to display a datagrid on my web form using this code:
    >>>>> Me.tripsDataGrid.DataSource = Me.tripsDataSet
    >>>>> Me.tripsDataGrid.DataMember =
    >>>>> Me.tripsDataSet.tripsTable.ToString
    >>>>> Me.tripsDataGrid.DataBind()
    >>>>>
    >>>>> It displays the DataGrid on the form with the column headers but no
    >>>>> data rows. The data is in the tripsTable rows because i can display
    >>>>> them in the debugger.
    >>>>>
    >>>>> How do i debug this to figure out why it is not populating the
    >>>>> datagrid ?
    >>>>>
    >>>>> Any help would be gratefully appreciated.
    >>>>>
    >>>>> Thanks,
    >>>>> Tony
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Tony Girgenti, Sep 29, 2006
    #6
    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. RonL
    Replies:
    0
    Views:
    757
  2. ringos75
    Replies:
    0
    Views:
    979
    ringos75
    Apr 14, 2005
  3. Mike C. Fletcher
    Replies:
    3
    Views:
    995
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Oct 12, 2003
  4. André
    Replies:
    3
    Views:
    1,618
  5. Novice
    Replies:
    0
    Views:
    133
    Novice
    May 7, 2004
Loading...

Share This Page