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. arrays with for loop

arrays with for loop

Scheduled Pinned Locked Moved ASP.NET
css
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.
  • R Offline
    R Offline
    rameshdontagani
    wrote on last edited by
    #1

    hi, i have a dagrid..in that checkboxes are there with ids of 1,2,3; i am passing the ids to that grid are 2,1..accordig to my logic those checkeboxes(1,2) has to be checked =true for ids 1,2 it is working if i pass the 3,2 then only 2nd checkbox is checking if i pass the 3...then no checkbox is checked... last checkbox is not checking for the last id.. i wrote the code like this in the databound event strScheduleIds=strScheduleId.Split(',');(here the values i am getting which i passed from the otherpage .) for(i=0;i<strScheduleIds.Length;i++) { foreach(DataGridItem dg in dglist.Items) { if(dg.Cells[9].Text.ToString()==strScheduleIds[i].ToString() ) { ((CheckBox)dg.FindControl("chk1")).Checked=true; } } }

    M 1 Reply Last reply
    0
    • R rameshdontagani

      hi, i have a dagrid..in that checkboxes are there with ids of 1,2,3; i am passing the ids to that grid are 2,1..accordig to my logic those checkeboxes(1,2) has to be checked =true for ids 1,2 it is working if i pass the 3,2 then only 2nd checkbox is checking if i pass the 3...then no checkbox is checked... last checkbox is not checking for the last id.. i wrote the code like this in the databound event strScheduleIds=strScheduleId.Split(',');(here the values i am getting which i passed from the otherpage .) for(i=0;i<strScheduleIds.Length;i++) { foreach(DataGridItem dg in dglist.Items) { if(dg.Cells[9].Text.ToString()==strScheduleIds[i].ToString() ) { ((CheckBox)dg.FindControl("chk1")).Checked=true; } } }

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      Have you tried to debug your code? strScheduleIds.Length - 1 in first for-loop? Are dg.Cells[9].Text.ToString() and strScheduleIds[i].ToString() the same if you pass "3"?

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

      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