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. datagrid problem

datagrid problem

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

    Dear all, We have a VB.Net 2003 winforms application. I have created a datagrid "datagrid1" with 3 columns in it(FirstName, LastName, CheckboxColumn). One of the columns is a checkbox column. Lets say the user selected 5 checkbox rows(out of 20 rows), I would like to retrieve the FirstName & LastName values for these selected 5 rows from the Datagrid & display it in a listbox. Please advise how can it be done. Your help is much appreciated.

    kissy

    A A 2 Replies Last reply
    0
    • K Kissy16

      Dear all, We have a VB.Net 2003 winforms application. I have created a datagrid "datagrid1" with 3 columns in it(FirstName, LastName, CheckboxColumn). One of the columns is a checkbox column. Lets say the user selected 5 checkbox rows(out of 20 rows), I would like to retrieve the FirstName & LastName values for these selected 5 rows from the Datagrid & display it in a listbox. Please advise how can it be done. Your help is much appreciated.

      kissy

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Kissy16 wrote:

      We have a VB.Net 2003 winforms application.

      This is ASP.Net Forum . Please put it in VB.NET section. Thanks

      cheers, Abhijit

      K 1 Reply Last reply
      0
      • A Abhijit Jana

        Kissy16 wrote:

        We have a VB.Net 2003 winforms application.

        This is ASP.Net Forum . Please put it in VB.NET section. Thanks

        cheers, Abhijit

        K Offline
        K Offline
        Kissy16
        wrote on last edited by
        #3

        sorry asp.net using vb in vs2003

        kissy

        A 1 Reply Last reply
        0
        • K Kissy16

          sorry asp.net using vb in vs2003

          kissy

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          if you want to retrive name on some button click, use FindControl method of grid view, and find the Checkbox then check which is selected or not. Hope this will help you.

          cheers, Abhijit

          K 1 Reply Last reply
          0
          • A Abhijit Jana

            if you want to retrive name on some button click, use FindControl method of grid view, and find the Checkbox then check which is selected or not. Hope this will help you.

            cheers, Abhijit

            K Offline
            K Offline
            Kissy16
            wrote on last edited by
            #5

            I am placin a bit of code here-- an give me some idea to fulfill my requirement Dim rowCount As Integer = 0 Dim strname As String Dim i As Integer i = 0 Dim DemoGridItem As DataGridItem For Each DemoGridItem In DG1.Items Dim myCheckbox As CheckBox = CType(DemoGridItem.Cells(0).Controls(1), CheckBox) If myCheckbox.Checked Then rowCount += 1 end if next In the above code how can i store the selected checkbox perticular column in the selected rows? I want to update that array of columns in the database at a time later. Can i do this?

            kissy

            A 1 Reply Last reply
            0
            • K Kissy16

              I am placin a bit of code here-- an give me some idea to fulfill my requirement Dim rowCount As Integer = 0 Dim strname As String Dim i As Integer i = 0 Dim DemoGridItem As DataGridItem For Each DemoGridItem In DG1.Items Dim myCheckbox As CheckBox = CType(DemoGridItem.Cells(0).Controls(1), CheckBox) If myCheckbox.Checked Then rowCount += 1 end if next In the above code how can i store the selected checkbox perticular column in the selected rows? I want to update that array of columns in the database at a time later. Can i do this?

              kissy

              A Offline
              A Offline
              Abhijit Jana
              wrote on last edited by
              #6

              Kissy16 wrote:

              In the above code how can i store the selected checkbox perticular column in the selected rows?

              Use DataGridRow class that can store particular row

              cheers, Abhijit

              1 Reply Last reply
              0
              • K Kissy16

                Dear all, We have a VB.Net 2003 winforms application. I have created a datagrid "datagrid1" with 3 columns in it(FirstName, LastName, CheckboxColumn). One of the columns is a checkbox column. Lets say the user selected 5 checkbox rows(out of 20 rows), I would like to retrieve the FirstName & LastName values for these selected 5 rows from the Datagrid & display it in a listbox. Please advise how can it be done. Your help is much appreciated.

                kissy

                A Offline
                A Offline
                Anudeep Jaiswal
                wrote on last edited by
                #7

                use this code foreach(gridview row in gridview1.rows) { } now this foreach loop move through all rows in that grid. now fetch the control and add the text into list...

                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