Results 1 to 4 of 4

Thread: How to assign DataRow to variable in grid?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Exclamation How to assign DataRow to variable in grid?

    Hi,

    Right now I am using a grid control from ComponentOne which I have to stay with. When I click an link in the row which fires a grid_ItemCommand event one of the parameters passed is e As C1.Web.C1WebGrid.C1CommandEventArgs. I want to change it where I am selecting a row with a checkbox in a column and then click a button to process the row selected. So I need to get the value it is putting in e and pass that which is used in another sub.

    Here is how e is assigned to "row" as DataRow. Can I do this myself if I know which row of the grid to do this for? Can someone show me?

    Thanks!!

    Code:
        Private Sub grid_ItemCommand(ByVal sender As Object, ByVal e As C1.Web.C1WebGrid.C1CommandEventArgs) Handles grid.ItemCommand
            Select Case e.CommandName
                Case "Renew"    ' Renew barcode
                    Dim row As DataRow = CType(e.Item.DataItem, DataRowView).Row
    I need to get row assigned by my own code by knowing which row it is. How can I do that?

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to assign DataRow to variable in grid?

    Hey,

    One "Standard" way of doing this would be to assign the Tag of the button that you are clicking on to the Index value for the row that is being bound to. This can either be done in the ASPX markup, or in the code behind.

    Then, on the click of the button, cast the Sender to type of Button, inspect the Tag property, and you will then have your Row Index, and you will be able to continue with your logic.

    Gary

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2000
    Posts
    1,463

    Re: How to assign DataRow to variable in grid?

    Thanks, it turns out with this special web grid control from C1 I cannot even tell the index of the row. So I will have to replace it with a gridview anyways. And then I can do what I need.

    Warren

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to assign DataRow to variable in grid?

    Oh! That sounds like a severe limitation of the control!

    The GridView is a very powerful control though, and most times, with a bit of work, you can bend it to your way of thinking

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width