You can do it easily with a bit of javascripting.
Make 3 hidden fields:
<input runat=server type=hidden id=inhAction />
<input runat=server type=hidden id=inhRow />
<input runat=server type=hidden id=inhColumn />
and a javascript function:
function cellClicked(row, column){
myForm.inhAction.value = "CELLCLICKED";
myForm.inhRow.value = row;
myForm.inhColumn.value = column;
myForm.submit();
}
and in the gridview's RowDataBound event setup the javascript call for every
cell:
myCell.Attributes["onclick"]=String.Format("cellClicked({0},{1})",
myCellRow, myCellColumn);
When you click a cell, you will get a postback. You can tell taht the
postback is caused by a cell click by looking in the inhAction and you can
get the row and the column numbers from the inhRow and inhColumn.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin http://usableasp.net
"K B" <ka**********@comcast.netwrote in message
news:OM**************@TK2MSFTNGP02.phx.gbl...
>I would like to create a gridview as below:
Project Name 1-1 1-2 1-3 1-4 1-5 1-6
Project 1 BLUE BLUE BLUE BLUE GREEN GREEN
more projects
I would like to fill the cell with a solid color based on the value of
the cell (e.g., documents that are complete (blue) or not complete
(green). In effect have a solid bar indicator going across each row. I
know how to color the cell based on the value, but not the click part.
Is there any way to do this so that I can then get row/cell information
based on the CELL clicked? I will need to retrieve the column title and
value of the cell as well as the first column value.
Any direction GREATLY appreciated!
Thanks,
Kit
*** Sent via Developersdex http://www.developersdex.com ***