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. moving the new row to the bottom

moving the new row to the bottom

Scheduled Pinned Locked Moved Web Development
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
    baselanfouqa
    wrote on last edited by
    #1

    i need to move the new row to be at the bottom and here's the code.. SqlConnection con = new SqlConnection(connectionstring); SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM BaselAnfouqa_Clients", con); try { DataTable dtBasel = new DataTable(); adp.Fill(dtBasel); DataRow drRow = dtBasel.NewRow(); dtBasel.Rows.InsertAt(drRow,0); gvtest.EditIndex = 0; gvtest.DataSource = dtBasel; gvtest.DataBind(); ((LinkButton)gvtest.Rows[1].Cells[0].Controls[0]).Text = ("Insert"); dtBasel.Clear(); } catch { } finally { con.Close(); }

    R 1 Reply Last reply
    0
    • B baselanfouqa

      i need to move the new row to be at the bottom and here's the code.. SqlConnection con = new SqlConnection(connectionstring); SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM BaselAnfouqa_Clients", con); try { DataTable dtBasel = new DataTable(); adp.Fill(dtBasel); DataRow drRow = dtBasel.NewRow(); dtBasel.Rows.InsertAt(drRow,0); gvtest.EditIndex = 0; gvtest.DataSource = dtBasel; gvtest.DataBind(); ((LinkButton)gvtest.Rows[1].Cells[0].Controls[0]).Text = ("Insert"); dtBasel.Clear(); } catch { } finally { con.Close(); }

      R Offline
      R Offline
      raghu g
      wrote on last edited by
      #2

      by taking the rowcount of the data table. and using the code dtBasel.Rows.Insertat(Newrow,Rowcount+1); This may help you..

      B 1 Reply Last reply
      0
      • R raghu g

        by taking the rowcount of the data table. and using the code dtBasel.Rows.Insertat(Newrow,Rowcount+1); This may help you..

        B Offline
        B Offline
        baselanfouqa
        wrote on last edited by
        #3

        forgive me but am new at this ..... i tried but an error happend (the name 'rowcount' doesnot exist in the current context) what should i do?

        C 1 Reply Last reply
        0
        • B baselanfouqa

          forgive me but am new at this ..... i tried but an error happend (the name 'rowcount' doesnot exist in the current context) what should i do?

          C Offline
          C Offline
          Craig Fahrenholz
          wrote on last edited by
          #4

          you haven't declared 'rowcount'. Try this : int rowcount = dtBasel.Rows.Count + 1; dtBasel.Rows.Insertat(Newrow,rowcount);

          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