Home All Groups Group Topic Archive Search About

Get Datakey Value from Gridview/sqldatasource

Author
22 Nov 2006 9:31 PM
KT
I need to get the unique datakeynames value from a query that is populating
the gridview and detailsview.

Example, I have a sqldatasource setup that is using a store procedure.  I
have the results from it populating a gridview.  However, I need the unique
id of the datakey to use for other objects on the web page.  How do I get
that key?

Thanks
KT

Author
24 Nov 2006 9:34 PM
Ranga
You can use the datakey values anywhere in the page.  You can do this by
gridview.DataKeys[rowindex].Values["Id"].

Regards

RT

Show quoteHide quote
"KT" <kt***@hotmail.com> wrote in message
news:ue8sK2nDHHA.3520@TK2MSFTNGP04.phx.gbl...
>I need to get the unique datakeynames value from a query that is populating
>the gridview and detailsview.
>
> Example, I have a sqldatasource setup that is using a store procedure.  I
> have the results from it populating a gridview.  However, I need the
> unique id of the datakey to use for other objects on the web page.  How do
> I get that key?
>
> Thanks
> KT
>
Author
28 Nov 2006 11:33 PM
KT
Thanks.  How do you use a return from a function with gridviews,
detailviews, etc.

KT

Show quoteHide quote
"Ranga" <ranga.tiru***@gmail.com> wrote in message
news:70EB9A6B-16E7-4DE2-AB62-F20756131BE8@microsoft.com...
> You can use the datakey values anywhere in the page.  You can do this by
> gridview.DataKeys[rowindex].Values["Id"].
>
> Regards
>
> RT
>
> "KT" <kt***@hotmail.com> wrote in message
> news:ue8sK2nDHHA.3520@TK2MSFTNGP04.phx.gbl...
>>I need to get the unique datakeynames value from a query that is
>>populating the gridview and detailsview.
>>
>> Example, I have a sqldatasource setup that is using a store procedure.  I
>> have the results from it populating a gridview.  However, I need the
>> unique id of the datakey to use for other objects on the web page.  How
>> do I get that key?
>>
>> Thanks
>> KT
>>
>