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. Get Control Value From GridView

Get Control Value From GridView

Scheduled Pinned Locked Moved ASP.NET
helpcss
3 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.
  • L Offline
    L Offline
    lrsalunkhe
    wrote on last edited by
    #1

    Respected, I have taken DropDownList and checkBox control in a Grid problem is when dropDown select of specific GridView row the CheckBox on the GridView selected row should be unCheck Please help me. Thanks

    K C 2 Replies Last reply
    0
    • L lrsalunkhe

      Respected, I have taken DropDownList and checkBox control in a Grid problem is when dropDown select of specific GridView row the CheckBox on the GridView selected row should be unCheck Please help me. Thanks

      K Offline
      K Offline
      kadaoui el mehdi
      wrote on last edited by
      #2

      From : Accessing the different controls inside a GridView control[^]

      foreach (GridViewRow row in GridView1.Rows)
      {
      // Selects the text from the TextBox

          // which is inside the GridView control
      
          string textBoxText = \_
            ((TextBox)row.FindControl("TextBox1")).Text;
          Response.Write(textBoxText);
          // Selects the text from the DropDownList
      
          // which is inside the GridView control
      
          string dropDownListText = ((DropDownList)
             row.FindControl("DropDownList1")).SelectedItem.Value;
          Response.Write(dropDownListText);
          // Selects items from the ListBox
      
          // which is inside the GridView control
      
          ListBox myListBox = (ListBox)row.FindControl("ListBox1");
      
          foreach(ListItem selectedItem in myListBox.Items)
          {
              // Checks if the item in the ListBox is selected or not
      
              if (selectedItem.Selected)
              {
                  // Print the value of the item if its selected
      
                  Response.Write(selectedItem.Value);
              }
          }
      }
      
      1 Reply Last reply
      0
      • L lrsalunkhe

        Respected, I have taken DropDownList and checkBox control in a Grid problem is when dropDown select of specific GridView row the CheckBox on the GridView selected row should be unCheck Please help me. Thanks

        C Offline
        C Offline
        carlecomm
        wrote on last edited by
        #3

        Hi, I think you can do something(such as JS function) when the selectedchanged event of the dropdownlist occurs. Then you should select the correct row and checkbox. You can bind them together when your table is created.

        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