cell double click

  • Thread starter Thread starter simon
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top