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. Problem with checkbox values in a datagrid

Problem with checkbox values in a datagrid

Scheduled Pinned Locked Moved ASP.NET
designhelpquestion
2 Posts 2 Posters 1 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.
  • M Offline
    M Offline
    mdupeire
    wrote on last edited by
    #1

    I have created a datagrid and added checkboxes to a template column. When I try to retreive the value of these checkboxes it always returns "checked = False" regardless of whether it is checked or not. This is my code: Private Sub cmdRequest_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdRequest.Click Dim grdItem As DataGridItem Dim chkRequested As New System.Web.UI.WebControls.CheckBox() Dim Requested As Boolean For Each grdItem In Me.grdAvailable.Items Requested = CType(grdItem.FindControl("chkRequest"), CheckBox).Checked If Requested = True Then 'Code goes here End If Next End Sub Why doesn't the checkbox hold a true value when checked? Thanks in advance, Michael

    U 1 Reply Last reply
    0
    • M mdupeire

      I have created a datagrid and added checkboxes to a template column. When I try to retreive the value of these checkboxes it always returns "checked = False" regardless of whether it is checked or not. This is my code: Private Sub cmdRequest_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdRequest.Click Dim grdItem As DataGridItem Dim chkRequested As New System.Web.UI.WebControls.CheckBox() Dim Requested As Boolean For Each grdItem In Me.grdAvailable.Items Requested = CType(grdItem.FindControl("chkRequest"), CheckBox).Checked If Requested = True Then 'Code goes here End If Next End Sub Why doesn't the checkbox hold a true value when checked? Thanks in advance, Michael

      U Offline
      U Offline
      User 377904
      wrote on last edited by
      #2

      Check out whether you enabling viewstate ? If not set that Let me know. Srinath

      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