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. selecting a row programatically via Button

selecting a row programatically via Button

Scheduled Pinned Locked Moved ASP.NET
helpquestion
7 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
    laziale
    wrote on last edited by
    #1

    Hi! I guess this is quite simple for some of you guys out there, but I am stuck whole morning with this issue. I do have a gridview control, and I have a button which will select the row where the checkbox is existing. After the gridview is selected, when the button is selected I want to put all the data in a strings, and play with that. Any help? Thx ahead, Laziale

    B 1 Reply Last reply
    0
    • L laziale

      Hi! I guess this is quite simple for some of you guys out there, but I am stuck whole morning with this issue. I do have a gridview control, and I have a button which will select the row where the checkbox is existing. After the gridview is selected, when the button is selected I want to put all the data in a strings, and play with that. Any help? Thx ahead, Laziale

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      Can you show your piece of code?

      Cheers!! Brij

      L 1 Reply Last reply
      0
      • B Brij

        Can you show your piece of code?

        Cheers!! Brij

        L Offline
        L Offline
        laziale
        wrote on last edited by
        #3

        I haven't do any coding for the ButtonEdit_Click event, cause there I am stuck and I don't know how to get the selected row with checkbox. Thx for helping me out...

        B 1 Reply Last reply
        0
        • L laziale

          I haven't do any coding for the ButtonEdit_Click event, cause there I am stuck and I don't know how to get the selected row with checkbox. Thx for helping me out...

          B Offline
          B Offline
          Brij
          wrote on last edited by
          #4

          Every Row has a checkbox Right?Can you provide your requirement in detail. Are you hiding checkbox sometimes based on some conditions? or anything else?

          Cheers!! Brij

          L 1 Reply Last reply
          0
          • B Brij

            Every Row has a checkbox Right?Can you provide your requirement in detail. Are you hiding checkbox sometimes based on some conditions? or anything else?

            Cheers!! Brij

            L Offline
            L Offline
            laziale
            wrote on last edited by
            #5

            ok...here is where I am stuck now. I declared a gridviewClass.AutoGenerateSelectButton = true in the Page_Load method, now how I can get the text from each field from the selectedrow and put them in a string? I tried with string test = ((TextBox)gridviewClass.SelectedRow.FindControl("Type")).Text; where 'Type' is the datafield what is attached to the asp:BoundField from the gridview control, but I am getting a NullReferenceException: Object reference not set to an instance of an object. Please someone out there help me. Thx ahead, Laziale :confused:

            L 1 Reply Last reply
            0
            • L laziale

              ok...here is where I am stuck now. I declared a gridviewClass.AutoGenerateSelectButton = true in the Page_Load method, now how I can get the text from each field from the selectedrow and put them in a string? I tried with string test = ((TextBox)gridviewClass.SelectedRow.FindControl("Type")).Text; where 'Type' is the datafield what is attached to the asp:BoundField from the gridview control, but I am getting a NullReferenceException: Object reference not set to an instance of an object. Please someone out there help me. Thx ahead, Laziale :confused:

              L Offline
              L Offline
              laziale
              wrote on last edited by
              #6

              I solved!!!! for someone else who might get this problem: I used this: string test = gridview1.SelectedRow.Cells[i].Text; have a nice day!!!!

              P 1 Reply Last reply
              0
              • L laziale

                I solved!!!! for someone else who might get this problem: I used this: string test = gridview1.SelectedRow.Cells[i].Text; have a nice day!!!!

                P Offline
                P Offline
                Pr teek B h
                wrote on last edited by
                #7

                You might want to write it something like this String test += gridview1.SelectedRow.Cells[i].Text; Otherwise you will only up with the text from the last selected row. Good job on solving the problem and thank you for solving the problem :), Prateek

                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