cell double click

S

simon

which data control allows me to use a cell doubleClick event?

I have time cells (something like Outlook calendar) and when user double
click on one cell I would like to redirect to other window where he could
insert events for that time. Then he go back to that page and see event in
that cell.

How can I do that?

Thank you,
Simon
 
J

Joe Gass

The html would be something like

<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td
onDblClick="javascript:window.location='http://www.google.com'">Double Click
this cell</td>
</tr>
</table>

Now to get that in a data bound control...
Perhaps with
..attributtes.add("onDblClick","javascript:window.location='/yourInsertEventP
age.aspx'")

On the relevant cell, during itemcreated or itemdatabound
 
S

simon

Thank you for your answer. Attributes.Add has only dataGrid( before I had
dataRepeater).
Now I would like that function test is executed when user doubleClicks on
the cell.
I must know which cell is, that I can insert events for that cell (time in
fact, because each cell represent the hour of a day) so I use
e.Item.itemIndex. But this code doesn't work.

Do you know why?

Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemCreated

DataGrid1.Attributes.Add("onDblClick", test(e.Item.ItemIndex))

End Sub

Function test(ByVal indeks)

label1.Text = indeks

End Function



Thank you,

Simon
 
S

simon

Hello,

I tried your example, it works ok, but I need to redirect to the page with
ID of clicked cell

If I try like this, I always get the ID of the last cell:

Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemCreated

If e.Item.ItemIndex <> -1 Then

Dim key As String = DataGrid1.DataKeys(e.Item.ItemIndex).ToString()

DataGrid1.Attributes.Add("onDblClick", "test('" & key & "')")

End If

End Sub

and on page:

<SCRIPT language="javascript">

function test(id)

{

window.location='http://www.redirectPage.aspx?id="+id

}

</SCRIPT>

Or with other words, How can I know which cell was double clicked?

Thank you,

Simon
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top