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. how to get the grid items???

how to get the grid items???

Scheduled Pinned Locked Moved ASP.NET
helpcssdesigntutorialquestion
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.
  • S Offline
    S Offline
    sarala s
    wrote on last edited by
    #1

    hi friends, fine and hope u so.. i am trying to include checkbox in the datagrid... this is my coding CheckBox chkbox = new CheckBox(); TextBox txtbox= new TextBox(); foreach(DataGridItem item in DGSample.items ) { chkbox=(CheckBox)item.FindControl("chkbox"); txtbox=(TextBox)item.FindControl("txtbox"); if(chkbox.Checked) { Response.Write(item.Cells[0].Text); } } in this coding i am getting probs...in the for loop..... initially i got error like this... Error:'System.Web.UI.WebControls.GridView' does not contain a definition for 'items' so ... i tried with foreach(DataGridItem item in DGSample.rows ) even i am getting error like Unable to cast object of type 'System.Web.UI.WebControls.GridViewRow' to type 'System.Web.UI.WebControls.DataGridItem'. can u anyone help me to solve this prob???

    W 1 Reply Last reply
    0
    • S sarala s

      hi friends, fine and hope u so.. i am trying to include checkbox in the datagrid... this is my coding CheckBox chkbox = new CheckBox(); TextBox txtbox= new TextBox(); foreach(DataGridItem item in DGSample.items ) { chkbox=(CheckBox)item.FindControl("chkbox"); txtbox=(TextBox)item.FindControl("txtbox"); if(chkbox.Checked) { Response.Write(item.Cells[0].Text); } } in this coding i am getting probs...in the for loop..... initially i got error like this... Error:'System.Web.UI.WebControls.GridView' does not contain a definition for 'items' so ... i tried with foreach(DataGridItem item in DGSample.rows ) even i am getting error like Unable to cast object of type 'System.Web.UI.WebControls.GridViewRow' to type 'System.Web.UI.WebControls.DataGridItem'. can u anyone help me to solve this prob???

      W Offline
      W Offline
      whatUrunning com
      wrote on last edited by
      #2

      The DataGridItem was used with the older DataGrid control. You need to use the following:

      foreach (GridViewRow item in DGSample.Rows)
      {
      }

      www.whatUrunning.com

      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