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. Empting a datagrid before adding new items

Empting a datagrid before adding new items

Scheduled Pinned Locked Moved ASP.NET
4 Posts 4 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.
  • M Offline
    M Offline
    Morgs Morgan
    wrote on last edited by
    #1

    Hi guys, am trying to empty my datagrid before i bind new records(items) I tried the following but they won't work:

    myDataGrid.DataSource = null;
    myDataGrid.DataBind();
    or
    myDataGrid.Dispose();

    A D G 3 Replies Last reply
    0
    • M Morgs Morgan

      Hi guys, am trying to empty my datagrid before i bind new records(items) I tried the following but they won't work:

      myDataGrid.DataSource = null;
      myDataGrid.DataBind();
      or
      myDataGrid.Dispose();

      A Offline
      A Offline
      Arun Jacob
      wrote on last edited by
      #2

      Even if you empty your grid it'll populate with the new records.then Why you want to empty datagrid before binding with new records?

      Arun Jacob http://codepronet.blogspot.com/

      1 Reply Last reply
      0
      • M Morgs Morgan

        Hi guys, am trying to empty my datagrid before i bind new records(items) I tried the following but they won't work:

        myDataGrid.DataSource = null;
        myDataGrid.DataBind();
        or
        myDataGrid.Dispose();

        D Offline
        D Offline
        daveyerwin
        wrote on last edited by
        #3

        From the example program in my reply to cheguri ...

        DropDownList1.Items.Clear();

        1 Reply Last reply
        0
        • M Morgs Morgan

          Hi guys, am trying to empty my datagrid before i bind new records(items) I tried the following but they won't work:

          myDataGrid.DataSource = null;
          myDataGrid.DataBind();
          or
          myDataGrid.Dispose();

          G Offline
          G Offline
          GauravKP
          wrote on last edited by
          #4

          Try this : DataTable dt = new DataTable; myDataGrid.DataSource = dt;

          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