HELP: Getting row column values in ASP.NET datagrid?

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default HELP: Getting row column values in ASP.NET datagrid?

    I have a datagrid bound to a dataset table.

    Unfortunately, the table's primary key consists of not 1, but 3
    columns, so I cannot correctly set the DataKeyField property of the
    grid (it only allows for 1 column), and, therefore, cannot use syntax
    like below in the event handlers in order to retrieve the primary key
    of the row:

    this.gridList.DataKeys[e.Item.ItemIndex]

    I still need to be able to get the values of all 3 key columns, yet I
    am not sure how. Any ideas?

    TIA!
    Usenet User Guest

  2. Similar Questions and Discussions

    1. Compare DataGrid Column Values
      I just created an application that displays data from 2 sources in a datagrid. There are 2 repeaters nested in the datagrid (probably not the best...
    2. Null values in a datagrid checkbox column
      I have a checkbox column in a bound datagrid that returns an error when it hits a null value: I can't modify the sql query to anticipate a null...
    3. How To: handle DataGrid row Click Event that passes rows column values to server-side code behind function
      I've looked through many posted messages, and have tried several things but have not seemed to solve this (what you'd think would be a simple)...
    4. Sum of a column values in a Datagrid
      Hi, I would like to know if there is a way to print 'Sum' of all the values of one of the columns in a datagrid in an ASP.net application using...
    5. how to Add different controls(textBox,DropDownList or some ) in the same column,based upon the value in the previous column (Say second Colum which contain dropdown with some values) ?
      I am new to ASP.NET. I am facing problem with datagrid. I will explain prob now. In the datagrid the first column is name in the second...
  3. #2

    Default RE: HELP: Getting row column values in ASP.NET datagrid?

    Place the primary keys on the grid using <asp:BoundColumn Visible=False
    DataField ="PrimaryKey1" ReadOnly =True ></asp:BoundColumn> In this way you
    can retrieve them and locate your records but the user would not see them. I
    have an example on this link [url]http://societopia.net/samples/datagrid_4c.aspx[/url]
    that works based on multiple primary keys to display a child datagrid and to
    update the values in the parent grid.

    --
    HTH,
    Phillip Williams
    [url]http://www.societopia.net[/url]
    [url]http://www.webswapp.com[/url]


    "Usenet User" wrote:
    > I have a datagrid bound to a dataset table.
    >
    > Unfortunately, the table's primary key consists of not 1, but 3
    > columns, so I cannot correctly set the DataKeyField property of the
    > grid (it only allows for 1 column), and, therefore, cannot use syntax
    > like below in the event handlers in order to retrieve the primary key
    > of the row:
    >
    > this.gridList.DataKeys[e.Item.ItemIndex]
    >
    > I still need to be able to get the values of all 3 key columns, yet I
    > am not sure how. Any ideas?
    >
    > TIA!
    >
    Phillip Williams Guest

  4. #3

    Default Re: HELP: Getting row column values in ASP.NET datagrid?

    Thank you!

    On Fri, 9 Sep 2005 19:40:04 -0700, "Phillip Williams"
    <Phillip.Williams@webswapp.com> wrote:
    >Place the primary keys on the grid using <asp:BoundColumn Visible=False
    >DataField ="PrimaryKey1" ReadOnly =True ></asp:BoundColumn> In this way you
    >can retrieve them and locate your records but the user would not see them. I
    >have an example on this link [url]http://societopia.net/samples/datagrid_4c.aspx[/url]
    >that works based on multiple primary keys to display a child datagrid and to
    >update the values in the parent grid.
    Usenet User Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139