aspx_beginners thread: accessing hyperLinkColumn control from inside Data Grid control
I've been having a lot of trouble with this ever since starting to
program with ASP.NET.
I have a hyperLinkColumn control that is encapsulated within a dataGrid
control column. What I want to do here is programmatically set the
navigateURL property of the hyperLinkColumn cell. Here's my scenario:
I've got a data grid that looks like this:
Date Employee
Monday John
Tuesday Chris
Wednesday Mark
Date and Employee are the headers.
When an event handler is fired (through the onItemDataBound property),
two properties are passed to the event handler ( dataGrid and
DataGridItemEventArgs objects ). I had success in manipulating the
Employee column using the columns property of the dataGrid class.
However, when I tried to manipulate the data in the columns, it skipped
out the topmost cell and would only append the navigateURL value to the
second and third cells (Chris and Mark). Does anyone know why this
happens?
In case this is not clear, I've posted a code snippet below:
sub formatData( server as object, e as dataGridItemEventArgs )
if ( e.item.itemType <> listItemType.header AND
e.item.itemType <> listItemType.footer ) then
server.columns( 1 ).navigateURL =3D
"http://www.thisURL.com"
end if
end sub
This event handler is fired when data is bound to the data grid.
Thanks.