Hyperlink as a TableCell

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?
 
C

Curt_C [MVP]

for the cursor
Style="Cursor:Hand;"


As for the other, how are you disabling it?
 
R

RA

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.
 
R

RA

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.
 
R

RA

Thank you Curt,

This solution sounds good.

I really appreciate for immediate replies.
 
G

Guest

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.
 
B

bruce barker

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?
|
|
 
R

RA

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top