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. General Programming
  3. Visual Studio
  4. how to remove a row from gridview but not from database.

how to remove a row from gridview but not from database.

Scheduled Pinned Locked Moved Visual Studio
databasetutorial
5 Posts 3 Posters 22 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.
  • S Offline
    S Offline
    Shivnandan singh
    wrote on last edited by
    #1

    void GVDetail_RowCommand_RowCommand(Object sender, GridViewCommandEventArgs e)
    {
    if(e.CommandName=="Remove")
    {
    var id = Int32.Parse(e.CommandArgument);
    GVDetail.DeleteRow(id);

    }
    }

    L D 3 Replies Last reply
    0
    • S Shivnandan singh

      void GVDetail_RowCommand_RowCommand(Object sender, GridViewCommandEventArgs e)
      {
      if(e.CommandName=="Remove")
      {
      var id = Int32.Parse(e.CommandArgument);
      GVDetail.DeleteRow(id);

      }
      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Is that supposed to be a question?

      S 1 Reply Last reply
      0
      • S Shivnandan singh

        void GVDetail_RowCommand_RowCommand(Object sender, GridViewCommandEventArgs e)
        {
        if(e.CommandName=="Remove")
        {
        var id = Int32.Parse(e.CommandArgument);
        GVDetail.DeleteRow(id);

        }
        }

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Just don't save the changes back to the database? :confused: Just because you do something to a datagrid, it does not mean that change is automatically written to the database. YOU have to write the code to save the changes back to the database. So, ... don't.

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
        Dave Kreskowiak

        1 Reply Last reply
        0
        • L Lost User

          Is that supposed to be a question?

          S Offline
          S Offline
          Shivnandan singh
          wrote on last edited by
          #4

          yes

          1 Reply Last reply
          0
          • S Shivnandan singh

            void GVDetail_RowCommand_RowCommand(Object sender, GridViewCommandEventArgs e)
            {
            if(e.CommandName=="Remove")
            {
            var id = Int32.Parse(e.CommandArgument);
            GVDetail.DeleteRow(id);

            }
            }

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            You can remove the datarow from your datasource bound to grid control and do not save this change in database when you remove row.

            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