Hyperlink as a TableCell

  • Thread starter Thread starter RA
  • Start date Start date
R

RA

While dynamically creating the table; I am adding a hyperlink as a TableCell
where text is "Delete". Initially it is disabled and if a checkbox is
selected from a table then it gets enabled. Even though it is disabled, if I
click on that cell it fires onClick event.
The other concern is it does not show Hand as its cursor; which we would
expect from a hyperlink. (NOTE: I am also adding hyperlinks to few other
TableCells, which are not disabled in the begining or any time. Those links
behaves fine.)

Any Suggestions?
 
for the cursor
Style="Cursor:Hand;"


As for the other, how are you disabling it?
 
The following code I am using to add "Delete" Hyperlink

Dim HLink As New HyperLink
HLink.ID = "DelLink"
HLink.Enabled = False
HLink.Attributes.Add("onClick", _
"return confirm('Are you Sure you want to delete " & _
"selected items?');")
HLink.navigateURL = "MasterReasonCode.aspx"
HLink.Text = "Delete"
hdrRow.Cells.Add(HLink))

As soon as any checkbox is checked; it gets enabled. For that I am using
JavaScript.

Thank you for prompt reply.
 
As I have following code for hyperlink

HLink.Attributes.Add("onClick", _
"return confirm('Are you Sure you want to delete " & _
"selected items?');")

Clicking that link(TableCell) it pops up a messagebox asking 'Are you sure
you want to delete selected items?' with "Ok" and "Cancel" buttons.

I have not written the code to delete items yet.
 
Well thats a good idea for confirmation!

RA said:
As I have following code for hyperlink

HLink.Attributes.Add("onClick", _
"return confirm('Are you Sure you want to delete " & _
"selected items?');")

Clicking that link(TableCell) it pops up a messagebox asking 'Are you sure
you want to delete selected items?' with "Ok" and "Cancel" buttons.

I have not written the code to delete items yet.
 
a hypelink renders as an anchor. there is no disable property for them in
html. also if there is no href specified, they will not render underlines or
hover mode (cursor). if you are doing a onclick, the standard url is "#".

to disable, don't set the url, or javascript. to enable, set the href to
"#", and add the onclick handler.

-- bruce (sqlwork.com)




| While dynamically creating the table; I am adding a hyperlink as a
TableCell
| where text is "Delete". Initially it is disabled and if a checkbox is
| selected from a table then it gets enabled. Even though it is disabled, if
I
| click on that cell it fires onClick event.
| The other concern is it does not show Hand as its cursor; which we would
| expect from a hyperlink. (NOTE: I am also adding hyperlinks to few other
| TableCells, which are not disabled in the begining or any time. Those
links
| behaves fine.)
|
| Any Suggestions?
|
|
 
As per your suggestion, I have added a label control and a Hyperlink control
in the same cell. Using following JavaScript to make them visible and
invisible.

function EnableBtn(theform)
{ if (rowsSelected != 0)
{ document.getElementById("DelLink").visible = true;
document.getElementById("DelLabel").visible = false; }
else
{ document.getElementById("DelLink").visible = false;
document.getElementById("DelLabel").visible = true; } }

When I debug through this code and try to see in the immediate window for
'document.getElementById("DelLink")' it shows null.

Other controls just shows fine where TableCell has only one control. But for
these two controls ('DelLink' and 'DelLabel') it displays null.

any clue?
 
Back
Top