L
lilfos
I feel like I'm missing something basic here, but I can't find anything
that answers my questions in MSDN or Google Groups. I have two link
columns in my DataGridView. I managed to bind them to columns in a
DataTable using the DataPropertyName property. All other columns are
bound manually. The cells look good, but they don't function properly
(well, at all). I can't get my click handler to figure out what link
was clicked.
The GUI design calls for one column to contain mailto links and one to
contain web page links. The mailtos should do the equivalent of
wrapping the email address displayed in the cell with the appropriate
<a> tag structure. Clicking it would launch a new message window from
the default email editor. The other column should show a page title in
each cell and handle the click by popping up a browser and loading the
desired URL.
Question 1: How do I handle the click for the link itself...not the
row, not the whole grid...just the link?? Everything I read says
something like, bind the column manually and use the cellclick event.
Does this mean that I need to loop through every row in table, add a
cell to the link column, and add an event handler for that cell that
builds an <a> tag and performs the desired action? That would be
really inelegant.
Question 2: When using a DataGridViewLinkColumn, what are the
equivalent of the Text and NavigateURL properties? Do I have to build
a link control for each cell and then set that into the Value property
of the DataGridViewLinkCell?
Bonus Question: This DataGridView supports dragging (drag from, but not
drop to). The MouseDown event seems to prevent the CellClick event
from firing. Assuming I can work everything else out, can I bubble up
the click so that MouseDown will handle a MouseDown/hold whereas a full
click would fire the click event?
Like I said, I feel like I'm just not getting the
DataGridViewLinkColumn. Other than alter text appearance, it really
doesn't seem to do anything useful. What am I missing??
Thanks
that answers my questions in MSDN or Google Groups. I have two link
columns in my DataGridView. I managed to bind them to columns in a
DataTable using the DataPropertyName property. All other columns are
bound manually. The cells look good, but they don't function properly
(well, at all). I can't get my click handler to figure out what link
was clicked.
The GUI design calls for one column to contain mailto links and one to
contain web page links. The mailtos should do the equivalent of
wrapping the email address displayed in the cell with the appropriate
<a> tag structure. Clicking it would launch a new message window from
the default email editor. The other column should show a page title in
each cell and handle the click by popping up a browser and loading the
desired URL.
Question 1: How do I handle the click for the link itself...not the
row, not the whole grid...just the link?? Everything I read says
something like, bind the column manually and use the cellclick event.
Does this mean that I need to loop through every row in table, add a
cell to the link column, and add an event handler for that cell that
builds an <a> tag and performs the desired action? That would be
really inelegant.
Question 2: When using a DataGridViewLinkColumn, what are the
equivalent of the Text and NavigateURL properties? Do I have to build
a link control for each cell and then set that into the Value property
of the DataGridViewLinkCell?
Bonus Question: This DataGridView supports dragging (drag from, but not
drop to). The MouseDown event seems to prevent the CellClick event
from firing. Assuming I can work everything else out, can I bubble up
the click so that MouseDown will handle a MouseDown/hold whereas a full
click would fire the click event?
Like I said, I feel like I'm just not getting the
DataGridViewLinkColumn. Other than alter text appearance, it really
doesn't seem to do anything useful. What am I missing??
Thanks