Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > aligning datagrid with datasource

Reply
Thread Tools

aligning datagrid with datasource

 
 
Jan Limpens
Guest
Posts: n/a
 
      11-07-2003
hi folks,

which is the best way to get to the datasource/row via a bound datagrid?

my datagrid is bound to a dataview.
when i select a button in the grid i want easy access to the
corresponding datarowview in the dataview.

until now my best bet is to get the datakey from the
datagrid.SelectedItem, sort my view by the key´s field and then use
dataview.Find() to get the row. but thats horribly cubersome and sorts
my view in a way i do not like it to be sorted!

i am very sure there must be a much better method which i haven't found
yet - please tell me

thanks
jj

 
Reply With Quote
 
 
 
 
Luca Bertoldi
Guest
Posts: n/a
 
      11-07-2003
Hi Jan,
it seems you need to use the
System.Web.UI.WebControls.DataGridCommandEventArgs parameter passed to the
event handler: it has an Item property which in turn has a DataItem property
that references the DataRowView you need to access.

Hope it helps,
Luca

"Jan Limpens" <(E-Mail Removed)-this.here> wrote
in message news:(E-Mail Removed)...
> hi folks,
>
> which is the best way to get to the datasource/row via a bound datagrid?
>
> my datagrid is bound to a dataview.
> when i select a button in the grid i want easy access to the
> corresponding datarowview in the dataview.
>
> until now my best bet is to get the datakey from the
> datagrid.SelectedItem, sort my view by the key´s field and then use
> dataview.Find() to get the row. but thats horribly cubersome and sorts
> my view in a way i do not like it to be sorted!
>
> i am very sure there must be a much better method which i haven't found
> yet - please tell me
>
> thanks
> jj
>



 
Reply With Quote
 
 
 
 
Jan Limpens
Guest
Posts: n/a
 
      11-07-2003
it does, thanks!

Luca Bertoldi wrote:

> Hi Jan,
> it seems you need to use the
> System.Web.UI.WebControls.DataGridCommandEventArgs parameter passed to the
> event handler: it has an Item property which in turn has a DataItem property
> that references the DataRowView you need to access.
>
> Hope it helps,
> Luca


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
right aligning values in datagrid column nemo ASP .Net 1 09-16-2005 02:58 AM
aligning datagrid columns =?Utf-8?B?SmVubmlmZXI=?= ASP .Net 1 11-22-2004 05:03 PM
Datagrid - Aligning Items Dave ASP .Net 2 11-13-2003 10:47 AM
aligning datagrid with datasource Jan Limpens ASP .Net Building Controls 2 11-07-2003 02:59 PM
aligning datagrid with datasource Jan Limpens ASP .Net Web Controls 2 11-07-2003 02:59 PM



Advertisments