Select a DataGrid row w/out a select column

Select a DataGrid row w/out a select column

Post by Michael McDowel » Thu, 08 Mar 2001 07:49:36



Here's what I want to do:

desplay a bunch of data using a DataGrid and I want the user to be able to
click on any row and see it highlighted (say by changing all cell bkg prop.
color on that row).  Can a DataGrid do this w/ out all the inline templating
code that I'll have to write to do it manually - eg inserting unique cell
id's, onclick events for each cell etc ..

Note the key requirment is for the user to be able to select anywhere on the
row (not a naff <select> row).

Ie how can I get the DataGrids onItemCommand to fire from a mouse event in a
databound column.

Any sugestions at all would be apreciated, even alternative strategies.

Thanks in advance,
Michael McDowell
2A Queensbridge Rd.
London E2 8NR
Tel. (home): + (44) 20 7613 2580
       (mobile): + (44) 410023 659

 
 
 

Select a DataGrid row w/out a select column

Post by Michael McDowel » Thu, 08 Mar 2001 09:05:32


I've just discovered that I can use:

the <datatextfield> property of the select columns in stead of the <text>
property i.e. <asp:ButtonColumn CommandName=Select
DataTextField="au_FName"/> and treat this as normal databound colum.  It's
not quite what I wanted but its almost there (you still have to click on the
text not just anywhere within the cell or row of cells so constructed).

Still looking for a better way to do this though so sugestion still needed!

Cheers,
Michael


> Here's what I want to do:

> desplay a bunch of data using a DataGrid and I want the user to be able to
> click on any row and see it highlighted (say by changing all cell bkg
prop.
> color on that row).  Can a DataGrid do this w/ out all the inline
templating
> code that I'll have to write to do it manually - eg inserting unique cell
> id's, onclick events for each cell etc ..

> Note the key requirment is for the user to be able to select anywhere on
the
> row (not a naff <select> row).

> Ie how can I get the DataGrids onItemCommand to fire from a mouse event in
a
> databound column.

> Any sugestions at all would be apreciated, even alternative strategies.

> Thanks in advance,
> Michael McDowell
> 2A Queensbridge Rd.
> London E2 8NR
> Tel. (home): + (44) 20 7613 2580
>        (mobile): + (44) 410023 659



 
 
 

Select a DataGrid row w/out a select column

Post by Michael McDowel » Thu, 08 Mar 2001 09:56:08


I'm talking to my self here... anyway

the <datatextfield> property approach dose not work as the fields are not
updatad when paging back and forth....  I think it's back to the old
fashioned way of doing things with embeded asp tags in the middle of my HTML
ugh

Michael


Quote:> I've just discovered that I can use:

> the <datatextfield> property of the select columns in stead of the <text>
> property i.e. <asp:ButtonColumn CommandName=Select
> DataTextField="au_FName"/> and treat this as normal databound colum.  It's
> not quite what I wanted but its almost there (you still have to click on
the
> text not just anywhere within the cell or row of cells so constructed).

> Still looking for a better way to do this though so sugestion still
needed!

 
 
 

Select a DataGrid row w/out a select column

Post by mukesh parek » Wed, 25 Apr 2001 15:56:08


Hi,

Checkout the Datagrids ItemCommand Event... When an item is selected from the grid... this event is fired and u can get the selected item by the selecteditem which is numeric & starts from 0. u also have the items collection in the event object e as e.item.....

Check out..
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

1. Selecting a specific column in the selected row of a DataGrid

I'm using VS2003 and working with a datagrid.

The datagrid is filled using a dataset.

After the DataGrid is filled the user may be inclinded to select one of
these entries, if the user selects a row I want to be able to store the
value belonging to a specific column in the row.  Right now im using
the CurrentCellChange event and calling
datagrid1[datagridcell.rownumber, x]. but that isn't working very
smoothly.

2. Windows NT -embedded without kybd, mouse, video?

3. Getting the value of a column/row when selecting a row in Datagrid

4. 486 Bridge Board???????

5. DataGrid full row select and Doubclick select

6. Upgrade drivers

7. How to locate the selected row of the datagrid to a specifc row in the datagrid

8. Newbie: altering Security Descriptors for a folder.

9. Selecting DISTINCT rows using DataTable.Select() method

10. Clicked row instead of Selected row of DataGrid on DoubleClick event

11. DataTable select specified columns only, distinct rows

12. How many rows are selected in the DataGrid