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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to get more than one datakeynames

How to get more than one datakeynames

Scheduled Pinned Locked Moved ASP.NET
csshelptutorial
5 Posts 2 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.
  • D Offline
    D Offline
    Deepak the Cool
    wrote on last edited by
    #1

    I used a Grid as following so anyone help me about : How I get the datakeynames(RegionCode,CountryCode) on GridView2_RowDeleting..... thanx in advance :)

    Deepak Smile a Lots,Its Costs Nothing

    K 1 Reply Last reply
    0
    • D Deepak the Cool

      I used a Grid as following so anyone help me about : How I get the datakeynames(RegionCode,CountryCode) on GridView2_RowDeleting..... thanx in advance :)

      Deepak Smile a Lots,Its Costs Nothing

      K Offline
      K Offline
      kaushal_prabhakar
      wrote on last edited by
      #2

      Hi Deepak, Its so simple to delete a particular row using GridView_RowDeleting command using cell index,its good to use DataKeyName when your gridview has two deletebutton column. here i am giving code to delete row on basis of cell index. if you want code of datakeyname then tell me.:) Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Dim i As Integer = CInt(GridView1.Rows(e.RowIndex).DataItemIndex) Dim rgncode As String = (GridView2.Rows(i).Cells(indexof regioncode column).Text).ToString Dim cntrycode As String = (GridView2.Rows(i).Cells(index of countrycode column).Text).ToString 'Your delete command code gone here GridView1.DataSource = 'name of datasource' GridView1.DataBind() End Sub

      prabhakar

      D 1 Reply Last reply
      0
      • K kaushal_prabhakar

        Hi Deepak, Its so simple to delete a particular row using GridView_RowDeleting command using cell index,its good to use DataKeyName when your gridview has two deletebutton column. here i am giving code to delete row on basis of cell index. if you want code of datakeyname then tell me.:) Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Dim i As Integer = CInt(GridView1.Rows(e.RowIndex).DataItemIndex) Dim rgncode As String = (GridView2.Rows(i).Cells(indexof regioncode column).Text).ToString Dim cntrycode As String = (GridView2.Rows(i).Cells(index of countrycode column).Text).ToString 'Your delete command code gone here GridView1.DataSource = 'name of datasource' GridView1.DataBind() End Sub

        prabhakar

        D Offline
        D Offline
        Deepak the Cool
        wrote on last edited by
        #3

        i have only one delete button but i use a group primary Keys(regionCode,countryCode) now i want to write a delete method with delete statemants and use this datakeynames values in Where condition.... that is my motto for doing that prrticular..... thnx for ur help but i want to need more detail....in C# ASP.net :)

        Deepak Smile a Lots,Its Costs Nothing

        K 1 Reply Last reply
        0
        • D Deepak the Cool

          i have only one delete button but i use a group primary Keys(regionCode,countryCode) now i want to write a delete method with delete statemants and use this datakeynames values in Where condition.... that is my motto for doing that prrticular..... thnx for ur help but i want to need more detail....in C# ASP.net :)

          Deepak Smile a Lots,Its Costs Nothing

          K Offline
          K Offline
          kaushal_prabhakar
          wrote on last edited by
          #4

          Ok, tell me you want to do this by using any datasource control or programatically. :)

          prabhakar

          D 1 Reply Last reply
          0
          • K kaushal_prabhakar

            Ok, tell me you want to do this by using any datasource control or programatically. :)

            prabhakar

            D Offline
            D Offline
            Deepak the Cool
            wrote on last edited by
            #5

            above code for my grid view it's bind programatically....

            Deepak Smile a Lots,Its Costs Nothing

            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