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. how to enable a check box in a gridview

how to enable a check box in a gridview

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

    I have a gridview that has an imagebutton column and a check box column.During GridView1_RowDataBound event i disable the checkbox column.Later when i click the image button i display a PDF document in a seperate window using a method named "exportgridview" and try to enable the corresponding checkbox.The problem is when i click the imagebutton the PDF is shown but the checkbox which is in the same row as the clicked imagebutton doesn't get enabled.I will show u the code in the imagebutton click event. protected void ImgBtnPDF_Click(object sender, ImageClickEventArgs e) { ImageButton ib = (ImageButton) sender; TableCell tablecell = (TableCell)ib.Parent; GridViewRow row = (GridViewRow)tablecell.Parent; CheckBox CBox = (CheckBox) row.FindControl("CheckBox2"); CBox.Enabled = true; Session["FamilyKey"] = row.Cells[1].Text; Session["StudentKey"] = row.Cells[2].Text; ExportGridView(); // this method shows the PDF in a seperate window }

    M 1 Reply Last reply
    0
    • J jahabardeen

      I have a gridview that has an imagebutton column and a check box column.During GridView1_RowDataBound event i disable the checkbox column.Later when i click the image button i display a PDF document in a seperate window using a method named "exportgridview" and try to enable the corresponding checkbox.The problem is when i click the imagebutton the PDF is shown but the checkbox which is in the same row as the clicked imagebutton doesn't get enabled.I will show u the code in the imagebutton click event. protected void ImgBtnPDF_Click(object sender, ImageClickEventArgs e) { ImageButton ib = (ImageButton) sender; TableCell tablecell = (TableCell)ib.Parent; GridViewRow row = (GridViewRow)tablecell.Parent; CheckBox CBox = (CheckBox) row.FindControl("CheckBox2"); CBox.Enabled = true; Session["FamilyKey"] = row.Cells[1].Text; Session["StudentKey"] = row.Cells[2].Text; ExportGridView(); // this method shows the PDF in a seperate window }

      M Offline
      M Offline
      Mitesh Darji
      wrote on last edited by
      #2

      you can write your code in GridView_RowCommand() event Dim ImageID As Integer = Convert.ToInt32(e.CommandArgument) If e.CommandName = "Image" Then 'Find the check box control and you can enable them. end if how to enable a check box in a gridview

      mitesh

      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