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. Set Input Radio to Checked in GridView

Set Input Radio to Checked in GridView

Scheduled Pinned Locked Moved ASP.NET
help
4 Posts 3 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.
  • H Offline
    H Offline
    HatakeKaKaShi
    wrote on last edited by
    #1

    Hi guys Need advise, I created a Gridview with a in it. I can bind the value inside but however when i need compare if the input type button should be checked. I face the problem. I can't seem to set the radio button to checked after i compare with some validation :: foreach (GridViewRow row in GridView1.Rows) { if (row.Cells[1].Text == "Brandon Tan") { ((RadioButton)row.FindControl("gvradio1")).Checked = true } }

    KaKaShi HaTaKe

    S N 2 Replies Last reply
    0
    • H HatakeKaKaShi

      Hi guys Need advise, I created a Gridview with a in it. I can bind the value inside but however when i need compare if the input type button should be checked. I face the problem. I can't seem to set the radio button to checked after i compare with some validation :: foreach (GridViewRow row in GridView1.Rows) { if (row.Cells[1].Text == "Brandon Tan") { ((RadioButton)row.FindControl("gvradio1")).Checked = true } }

      KaKaShi HaTaKe

      S Offline
      S Offline
      Sundar_R
      wrote on last edited by
      #2

      you need to replace your html radio button with asp radio button <asp:RadioButton ID="gvradio1" runat="server" />

      H 1 Reply Last reply
      0
      • S Sundar_R

        you need to replace your html radio button with asp radio button <asp:RadioButton ID="gvradio1" runat="server" />

        H Offline
        H Offline
        HatakeKaKaShi
        wrote on last edited by
        #3

        but in these case the radio button will allow mutiple check but i need to restrict to select one only.

        KaKaShi HaTaKe

        1 Reply Last reply
        0
        • H HatakeKaKaShi

          Hi guys Need advise, I created a Gridview with a in it. I can bind the value inside but however when i need compare if the input type button should be checked. I face the problem. I can't seem to set the radio button to checked after i compare with some validation :: foreach (GridViewRow row in GridView1.Rows) { if (row.Cells[1].Text == "Brandon Tan") { ((RadioButton)row.FindControl("gvradio1")).Checked = true } }

          KaKaShi HaTaKe

          N Offline
          N Offline
          Nishant Singh
          wrote on last edited by
          #4

          Try setting

          <input type="Radio" name="gvradio" id="gvradio1" runat=server>

          ;

          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