Noob question - binding data to list box (system.data.datarowview?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Arch Stanton

    Noob question - binding data to list box (system.data.datarowview?)

    I'm trying to bind data in a dataset (obtained from an Access DB) to a
    listbox in ASP.net. I know my dataset is being created properly because
    it displays fine in a datagrid, but I can't get it to display in a
    listbox. Here's what I'm trying:

    dgrDataGrid.Dat aSource = dstData.Tables( "Manufactur er")
    lstMake.datasou rce = dstData.Tables( "Manufactur er")
    Page.DataBind

    There is only one column in the dataset's table, and the datagrid
    displays it the way I want. But my listbox just repeats the line
    "system.data.da tarowview" over and over.

    Any help is, as usual, appreciated.
  • Lloyd Sheen

    #2
    Re: Noob question - binding data to list box (system.data.da tarowview?)


    "Arch Stanton" <sade@hill.orgw rote in message
    news:zZCdnSmRF8 Ka75rVnZ2dnUVZ_ sWdnZ2d@comcast .com...
    I'm trying to bind data in a dataset (obtained from an Access DB) to a
    listbox in ASP.net. I know my dataset is being created properly because it
    displays fine in a datagrid, but I can't get it to display in a listbox.
    Here's what I'm trying:
    >
    dgrDataGrid.Dat aSource = dstData.Tables( "Manufactur er")
    lstMake.datasou rce = dstData.Tables( "Manufactur er")
    Page.DataBind
    >
    There is only one column in the dataset's table, and the datagrid displays
    it the way I want. But my listbox just repeats the line
    "system.data.da tarowview" over and over.
    >
    Any help is, as usual, appreciated.
    You need to tell the listbox what to display. The default is the .toString
    so you are getting the object type as each occurence.

    LS

    Comment

    • David Wier

      #3
      Re: Noob question - binding data to list box (system.data.da tarowview?)

      You need to tell it, from the dataset you get returned what to display and
      what to assign to the 'value' of the item
      Like Product for DataTextField and ProductID for DataValueField

      David Wier

      http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
      bloated markup


      "Arch Stanton" <sade@hill.orgw rote in message
      news:zZCdnSmRF8 Ka75rVnZ2dnUVZ_ sWdnZ2d@comcast .com...
      I'm trying to bind data in a dataset (obtained from an Access DB) to a
      listbox in ASP.net. I know my dataset is being created properly because it
      displays fine in a datagrid, but I can't get it to display in a listbox.
      Here's what I'm trying:
      >
      dgrDataGrid.Dat aSource = dstData.Tables( "Manufactur er")
      lstMake.datasou rce = dstData.Tables( "Manufactur er")
      Page.DataBind
      >
      There is only one column in the dataset's table, and the datagrid displays
      it the way I want. But my listbox just repeats the line
      "system.data.da tarowview" over and over.
      >
      Any help is, as usual, appreciated.

      Comment

      • Arch Stanton

        #4
        Re: Noob question - binding data to list box (system.data.da tarowview?)


        Replies solved my problem. You guys rule.

        -Grateful Noob :|



        David Wier wrote:
        You need to tell it, from the dataset you get returned what to display and
        what to assign to the 'value' of the item
        Like Product for DataTextField and ProductID for DataValueField
        >
        David Wier

        http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
        bloated markup
        >
        >
        "Arch Stanton" <sade@hill.orgw rote in message
        news:zZCdnSmRF8 Ka75rVnZ2dnUVZ_ sWdnZ2d@comcast .com...
        >I'm trying to bind data in a dataset (obtained from an Access DB) to a
        >listbox in ASP.net. I know my dataset is being created properly because it
        >displays fine in a datagrid, but I can't get it to display in a listbox.
        >Here's what I'm trying:
        >>
        >dgrDataGrid.Da taSource = dstData.Tables( "Manufactur er")
        >lstMake.dataso urce = dstData.Tables( "Manufactur er")
        >Page.DataBin d
        >>
        >There is only one column in the dataset's table, and the datagrid displays
        >it the way I want. But my listbox just repeats the line
        >"system.data.d atarowview" over and over.
        >>
        >Any help is, as usual, appreciated.
        >
        >

        Comment

        • Arch Stanton

          #5
          Re: Noob question - binding data to list box (system.data.da tarowview?)

          Replies solved my problem. You guys rule.

          -Grateful Noob :|



          Lloyd Sheen wrote:
          >
          "Arch Stanton" <sade@hill.orgw rote in message
          news:zZCdnSmRF8 Ka75rVnZ2dnUVZ_ sWdnZ2d@comcast .com...
          >I'm trying to bind data in a dataset (obtained from an Access DB) to a
          >listbox in ASP.net. I know my dataset is being created properly
          >because it displays fine in a datagrid, but I can't get it to display
          >in a listbox. Here's what I'm trying:
          >>
          >dgrDataGrid.Da taSource = dstData.Tables( "Manufactur er")
          >lstMake.dataso urce = dstData.Tables( "Manufactur er")
          >Page.DataBin d
          >>
          >There is only one column in the dataset's table, and the datagrid
          >displays it the way I want. But my listbox just repeats the line
          >"system.data.d atarowview" over and over.
          >>
          >Any help is, as usual, appreciated.
          >
          You need to tell the listbox what to display. The default is the
          .toString so you are getting the object type as each occurence.
          >
          LS

          Comment

          Working...