need some help with datagrid/datasets

Results 1 to 2 of 2

Thread: need some help with datagrid/datasets

  1. #1
    Join Date
    Dec 1969

    Default need some help with datagrid/datasets

    Hi, I recently started using ASP.NET web matrix and I need some help from you guys regarding datagrids/datasets.<BR><BR>Here&#039;s my question..:<BR>I used the SELECT data method to get a unique ID from one of my databases to display on a datagrid. After displaying it, I would also like to use that ID to insert into a different database. However, I don&#039;t know how to get that exact number from the datagrid. I tried looking through the Matrix ClassBrowser to look for fields/members that I could acces, but no luck so far. Here&#039;s what I came up with so far:<BR>DataGrid1.Items.Item(0).DataItem<BR>But this doesn&#039;t give me the ID. I always get 0 instead. Do you guys have any suggestions I could use? Thanks in advance.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: need some help with datagrid/datasets

    Look up the DataKeys collection of the DataGrid - You can assign your ID Field to the DataGrid like so:<BR><BR>&#060;asp:DataGrid<BR>ID=YourDataGrid<B R>DataKeyField=YourID<BR>Runat=server/&#062;<BR><BR>You can then refer to it in code using<BR><BR>YourDataGrid.DataKeys(e.Item.ItemInde x)

Posting Permissions

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