Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Datagrid Designer question

Datagrid Designer question

Scheduled Pinned Locked Moved ASP.NET
questiondatabase
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    work_to_live
    wrote on last edited by
    #1

    I've been playing around with a web application driven by an Access Database. I can programmatically connect to the database fill a dataset, bind the dataset to the datagrid, and everything works as expected. Here's my question... I thought I could do all that from the designer, so I commented out code that programmatically connects to the database loads the dataset, and binds to the Datagrid. Then made the same connections with the designer through the properties of the DataGrid. In the designer, I added a DataAdapter, and generated a Dataset from it. Then I set the DataGrid DataSource to the DataSet, and Set the DataMember to a table within the Dataset. In the PageLoad event handler, I added a call to DataBind(), but when I run the app, the DataGrid doesn't load! Am I trying to do too much with the designer?

    S M 2 Replies Last reply
    0
    • W work_to_live

      I've been playing around with a web application driven by an Access Database. I can programmatically connect to the database fill a dataset, bind the dataset to the datagrid, and everything works as expected. Here's my question... I thought I could do all that from the designer, so I commented out code that programmatically connects to the database loads the dataset, and binds to the Datagrid. Then made the same connections with the designer through the properties of the DataGrid. In the designer, I added a DataAdapter, and generated a Dataset from it. Then I set the DataGrid DataSource to the DataSet, and Set the DataMember to a table within the Dataset. In the PageLoad event handler, I added a call to DataBind(), but when I run the app, the DataGrid doesn't load! Am I trying to do too much with the designer?

      S Offline
      S Offline
      StylezHouse
      wrote on last edited by
      #2

      Personally, i loath doing any of that via the designer.... But regardless.... You said you databinded, but did you fill the dataset? SqlDataAdapter1.Fill(Dataset1) Datagrid1.Databind()

      W 1 Reply Last reply
      0
      • S StylezHouse

        Personally, i loath doing any of that via the designer.... But regardless.... You said you databinded, but did you fill the dataset? SqlDataAdapter1.Fill(Dataset1) Datagrid1.Databind()

        W Offline
        W Offline
        work_to_live
        wrote on last edited by
        #3

        I'm just about at that point... It looks like I need to learn all the quirks of the designer, instead of doing something useful. I went back to my hard coded version, and will come back to the designer approach some day... Maybe!

        S 1 Reply Last reply
        0
        • W work_to_live

          I'm just about at that point... It looks like I need to learn all the quirks of the designer, instead of doing something useful. I went back to my hard coded version, and will come back to the designer approach some day... Maybe!

          S Offline
          S Offline
          StylezHouse
          wrote on last edited by
          #4

          Either way it gets "Hard Coded" Just expand the Region of auto generated microsoft code and you'll see it.

          1 Reply Last reply
          0
          • W work_to_live

            I've been playing around with a web application driven by an Access Database. I can programmatically connect to the database fill a dataset, bind the dataset to the datagrid, and everything works as expected. Here's my question... I thought I could do all that from the designer, so I commented out code that programmatically connects to the database loads the dataset, and binds to the Datagrid. Then made the same connections with the designer through the properties of the DataGrid. In the designer, I added a DataAdapter, and generated a Dataset from it. Then I set the DataGrid DataSource to the DataSet, and Set the DataMember to a table within the Dataset. In the PageLoad event handler, I added a call to DataBind(), but when I run the app, the DataGrid doesn't load! Am I trying to do too much with the designer?

            M Offline
            M Offline
            minhpc_bk
            wrote on last edited by
            #5

            Hi there, As StylezHouse pointed out that you basically need to do two more things though you drag/drop data components from the Toolbox: + Fill data in the dataset. + Bind data to the grid calling the DataBind method (you've done that). This is a limitation in the ASP.NET 1.1. Though you have generated the dataset object from the adapter, the dataset is not automatically filled in with data, so you need to do that in code. Also, you need to call the DataBind method as the grid does not automatically display data in the specified datasource. A good news is that this issue is addressed in ASP.NET 2.0, you won't even place any code in the page, what you need to do is to drag/drop the gridview (the successor of the datagrid control) and the datasource control on the web page, and done!

            W 1 Reply Last reply
            0
            • M minhpc_bk

              Hi there, As StylezHouse pointed out that you basically need to do two more things though you drag/drop data components from the Toolbox: + Fill data in the dataset. + Bind data to the grid calling the DataBind method (you've done that). This is a limitation in the ASP.NET 1.1. Though you have generated the dataset object from the adapter, the dataset is not automatically filled in with data, so you need to do that in code. Also, you need to call the DataBind method as the grid does not automatically display data in the specified datasource. A good news is that this issue is addressed in ASP.NET 2.0, you won't even place any code in the page, what you need to do is to drag/drop the gridview (the successor of the datagrid control) and the datasource control on the web page, and done!

              W Offline
              W Offline
              work_to_live
              wrote on last edited by
              #6

              Thanks... I've added those two calls to my pages, and everything's working fine. Was just wondering if I was missing something.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups