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. can we directly assign a value to row in the gridview

can we directly assign a value to row in the gridview

Scheduled Pinned Locked Moved ASP.NET
cssdatabase
2 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.
  • F Offline
    F Offline
    Flavia A
    wrote on last edited by
    #1

    can we directly assign a value to a particular cell of row in the gridview. using the select statement select 'flavia' as name, 'A'as surname i bound the data to the gridview.. but on the selected Index changed of the grid view i want the data to be displayed in the text boxes ..which i managed using the gridview1.SelectedRow.cells[1].text= txtName.text; but after modifying the textbox txtName for (i = 0; i < GridView3.Rows.Count; i++) { string b if (GridView3.Rows[i].Cells[1].Text.ToString()== s) { GridView1.Rows[i].Cells[1].Text = txtName.Text; } } but it is giving an exception {System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection}

    C 1 Reply Last reply
    0
    • F Flavia A

      can we directly assign a value to a particular cell of row in the gridview. using the select statement select 'flavia' as name, 'A'as surname i bound the data to the gridview.. but on the selected Index changed of the grid view i want the data to be displayed in the text boxes ..which i managed using the gridview1.SelectedRow.cells[1].text= txtName.text; but after modifying the textbox txtName for (i = 0; i < GridView3.Rows.Count; i++) { string b if (GridView3.Rows[i].Cells[1].Text.ToString()== s) { GridView1.Rows[i].Cells[1].Text = txtName.Text; } } but it is giving an exception {System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection}

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Flavia A wrote:

      {System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection}

      Do you know how to use the debugger ? Do you have any understanding of English ? Obviously one of your rows does not have 2 cells in it, for some reason. That's a guess, if you used the debugger, you should be able to work it out AND tell us what line blows up if you need to.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      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