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. how can i clear gridview

how can i clear gridview

Scheduled Pinned Locked Moved ASP.NET
question
15 Posts 6 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.
  • R Offline
    R Offline
    rajkumar 3
    wrote on last edited by
    #1

    please give me simple code to clear gridview

    H S B A 4 Replies Last reply
    0
    • R rajkumar 3

      please give me simple code to clear gridview

      H Offline
      H Offline
      Herman T Instance
      wrote on last edited by
      #2

      gridview.DataSource = null;

      R 1 Reply Last reply
      0
      • H Herman T Instance

        gridview.DataSource = null;

        R Offline
        R Offline
        rajkumar 3
        wrote on last edited by
        #3

        no its not like that, i want to clear the data in gridview then fill some other data in same gridview.

        H 1 Reply Last reply
        0
        • R rajkumar 3

          no its not like that, i want to clear the data in gridview then fill some other data in same gridview.

          H Offline
          H Offline
          Herman T Instance
          wrote on last edited by
          #4

          sounds like you have a refresh problem. Is your gridview in an updatePanel? Is the gridview DataBound after set to null ? gridview.DataSource = null; gridview.DataBind();

          1 Reply Last reply
          0
          • R rajkumar 3

            please give me simple code to clear gridview

            S Offline
            S Offline
            senthilsstil
            wrote on last edited by
            #5

            Hi RajKumar, adap.Fill(ds,"table1"); ds.Clear();Clear the dataset and Then fill another data and bind to the gridview

            R 1 Reply Last reply
            0
            • R rajkumar 3

              please give me simple code to clear gridview

              B Offline
              B Offline
              Blue_Boy
              wrote on last edited by
              #6

              if you have AutoGenerating Columns then just change the DataSource example: GridView1.DataSource = datasource GridView.DataBind(); GridView1.DataSource = newdatasource GridView.DataBind(); if you are using BoundFields then I will sugest u using new GridView control for new datasource


              I Love T-SQL

              V 1 Reply Last reply
              0
              • S senthilsstil

                Hi RajKumar, adap.Fill(ds,"table1"); ds.Clear();Clear the dataset and Then fill another data and bind to the gridview

                R Offline
                R Offline
                rajkumar 3
                wrote on last edited by
                #7

                hi i am not using any adapetr or dataset . i am using data table.

                S 1 Reply Last reply
                0
                • R rajkumar 3

                  hi i am not using any adapetr or dataset . i am using data table.

                  S Offline
                  S Offline
                  senthilsstil
                  wrote on last edited by
                  #8

                  Hi RajKumar, ok then will have a option dt.Clear();

                  R 1 Reply Last reply
                  0
                  • B Blue_Boy

                    if you have AutoGenerating Columns then just change the DataSource example: GridView1.DataSource = datasource GridView.DataBind(); GridView1.DataSource = newdatasource GridView.DataBind(); if you are using BoundFields then I will sugest u using new GridView control for new datasource


                    I Love T-SQL

                    V Offline
                    V Offline
                    Vijayitsb
                    wrote on last edited by
                    #9

                    You want to clear and Fill the grid.You want these two process in two different events or only one event.

                    Cheers..! Vijay s

                    R 1 Reply Last reply
                    0
                    • V Vijayitsb

                      You want to clear and Fill the grid.You want these two process in two different events or only one event.

                      Cheers..! Vijay s

                      R Offline
                      R Offline
                      rajkumar 3
                      wrote on last edited by
                      #10

                      see i am using datatable to fill gridview and i am using this for some calculater ... it will display result in grid view .. after one one calculation if user want to do next calculation then previous record shd not display.. plz help me in this.

                      V 1 Reply Last reply
                      0
                      • R rajkumar 3

                        see i am using datatable to fill gridview and i am using this for some calculater ... it will display result in grid view .. after one one calculation if user want to do next calculation then previous record shd not display.. plz help me in this.

                        V Offline
                        V Offline
                        Vijayitsb
                        wrote on last edited by
                        #11

                        So you are not using DB.How many DataTable you are using ? Can you send your Code..?

                        Thank & Regards Vijay s

                        R 1 Reply Last reply
                        0
                        • S senthilsstil

                          Hi RajKumar, ok then will have a option dt.Clear();

                          R Offline
                          R Offline
                          rajkumar 3
                          wrote on last edited by
                          #12

                          see i am using datatable to fill gridview and i am using this for some calculater ... it will display result in grid view .. after one one calculation if user want to do next calculation then previous record shd not display..

                          1 Reply Last reply
                          0
                          • V Vijayitsb

                            So you are not using DB.How many DataTable you are using ? Can you send your Code..?

                            Thank & Regards Vijay s

                            R Offline
                            R Offline
                            rajkumar 3
                            wrote on last edited by
                            #13

                            can u tell me how to delete complete data only from data table before adding data to it ?

                            V 1 Reply Last reply
                            0
                            • R rajkumar 3

                              can u tell me how to delete complete data only from data table before adding data to it ?

                              V Offline
                              V Offline
                              Vijayitsb
                              wrote on last edited by
                              #14

                              if you delete row use this code. dt.Rows[Index].Delete() Or if u want delete data dt.Rows[Index]["ColumnName"] = null;

                              Thank & Regards Vijay s

                              1 Reply Last reply
                              0
                              • R rajkumar 3

                                please give me simple code to clear gridview

                                A Offline
                                A Offline
                                Ashish Sehajpal
                                wrote on last edited by
                                #15

                                simply bind the gridview without specifying the datasource...data will get vanished

                                Ashish Sehajpal

                                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