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. Solution to Gridview?

Solution to Gridview?

Scheduled Pinned Locked Moved ASP.NET
csharpquestiondatabase
4 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.
  • B Offline
    B Offline
    blurMember
    wrote on last edited by
    #1

    I am doing a project using .net 2.0 C#. I used the SqlDataSource control to populate the database and then attach it to the gridview. The gridview works well if I run the code first time, meaning the gridview will display that SqlDataSource. But how can I achieve to display that SqlDataSource only upon user clicking a button called btnRefresh.:doh:

    thanks in advance. Much appreciated.

    K M 2 Replies Last reply
    0
    • B blurMember

      I am doing a project using .net 2.0 C#. I used the SqlDataSource control to populate the database and then attach it to the gridview. The gridview works well if I run the code first time, meaning the gridview will display that SqlDataSource. But how can I achieve to display that SqlDataSource only upon user clicking a button called btnRefresh.:doh:

      thanks in advance. Much appreciated.

      K Offline
      K Offline
      kiran kumar Intelligroup
      wrote on last edited by
      #2

      In btnRefresh_click method only you open the connection and bind the gridview

      1 Reply Last reply
      0
      • B blurMember

        I am doing a project using .net 2.0 C#. I used the SqlDataSource control to populate the database and then attach it to the gridview. The gridview works well if I run the code first time, meaning the gridview will display that SqlDataSource. But how can I achieve to display that SqlDataSource only upon user clicking a button called btnRefresh.:doh:

        thanks in advance. Much appreciated.

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

        There are many ways to do that: + You don't assign the id of the SqlDataSource control to the DataSourceId property of the GridView control until the button is clicked. + In the button click event handler, you can call the Select method of the datasource control and assign the result to the GridView control. + You can manage to populate the datasource instead of using the SqlDataSource control in the button click event handler. + You can keep doing the way that you are familar but only make the GridView control visible until the button is clicked. ....

        B 1 Reply Last reply
        0
        • M minhpc_bk

          There are many ways to do that: + You don't assign the id of the SqlDataSource control to the DataSourceId property of the GridView control until the button is clicked. + In the button click event handler, you can call the Select method of the datasource control and assign the result to the GridView control. + You can manage to populate the datasource instead of using the SqlDataSource control in the button click event handler. + You can keep doing the way that you are familar but only make the GridView control visible until the button is clicked. ....

          B Offline
          B Offline
          blurMember
          wrote on last edited by
          #4

          Actually I have a textbox for user to key data and then when the user click btnSubmit, that data will be stored in the database.

          minhpc_bk wrote:

          + You can keep doing the way that you are familar but only make the GridView control visible until the button is clicked.

          I kind of like this method. However I encounter error, if I click btnRefresh, the database its not updated. :doh:

          thanks in advance. Much appreciated.

          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