Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jhermiz
3564 Posts |
Posted - 2004-10-04 : 07:40:08
|
I have a datagrid and I know you can make specific columns clickable,but what I want to do is make the entire item / row in the data grid clickable, so when you roll over it...you see the little hand to be able to click it.I dont like it right now with my one column being clickable,I want to be able to have the entire item / row in a HREF ????Thanks,Jon |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-04 : 09:51:25
|
Use a repeater, put your row in a DIV with a click event.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-04 : 10:30:07
|
i cant use a repeater :( |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-04 : 10:50:52
|
Well, maybe a TemplateColumn (is that the right word?) in your datagrid with something similar.I've never tried to do what you are doing, but I think a DIV is the only way you are gonna be able to do this.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2004-10-04 : 10:59:52
|
You could put a javascript event on the table row so when it is clicked it will do whatever you want.if(document.getElementById) window.onload = onLoad;function onLoad(){ setupClickableTableRowEvents();}function setupClickableTableRowEvents(){ var dataGrid = document.getElementById("<Your data grid id would go here>"); if(dataGrid == null) return; var tableRows = dataGrid.getElementsByTagName("tr"); for(var counter = 0; counter < tableRows.length; counter++) tableRows[counter].onclick = onClickTableRow;}function onClickTableRow(){ <Write your javascript for clicking a table row here>} PS. You should try to get away from data grids because they suck. Try to use repeaters whenever you can. |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-04 : 11:01:06
|
Interesting! That should work too.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
jhermiz
3564 Posts |
Posted - 2004-10-04 : 14:32:10
|
just saw the PS :(...Im a little far ahead...Justin I m not sure what you mean in your example...Is that gonna allow me to click an entire row from a datagrid? |
 |
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2004-10-04 : 14:41:47
|
quote: Originally posted by jhermiz just saw the PS :(...Im a little far ahead...Justin I m not sure what you mean in your example...Is that gonna allow me to click an entire row from a datagrid?
Maybe I was a little to harsh on DataGrids. At my job we can't use them because we have to make ASP.NET pages that follow web accessibility standards. Basically the DataGrid makes alot of junk html that isn't accessible. For example, the table is makes does not include table header (<th>) tags. The good thing about the repeater is that you can do anything that a datagrid can do and since you have more control over the html it makes you can make leaner pages.Also I think this script will work for you if your trying to perform a client side event when the row is clicked. However, if the click must perform a server side event I'm afraid this script will not work for you :(Dustin Michaels |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2004-10-04 : 14:57:09
|
I bet a repeater with an ASP Link button around the Table row would work.Jon, you've gotta learn how to do repeaters. They are not the solution for everything, but if you want something special then they are usually part of the solution since you have total control of how the rendering happens.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
 |
|
|
|
|
|
|