cell double click

Discussion in 'ASP .Net' started by simon, Dec 3, 2003.

  1. simon

    simon Guest

    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
    simon, Dec 3, 2003
    #1
    1. Advertising

  2. simon

    Joe Gass Guest

    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



    "simon" <> wrote in message
    news:...
    > 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
    >
    >
    Joe Gass, Dec 3, 2003
    #2
    1. Advertising

  3. simon

    simon Guest

    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

    "Joe Gass" <> wrote in message
    news:...
    > 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
    >
    >
    >
    > "simon" <> wrote in message
    > news:...
    > > 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
    > >
    > >

    >
    >
    simon, Dec 3, 2003
    #3
  4. simon

    simon Guest

    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

    "simon" <> wrote in message
    news:...
    > 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
    >
    > "Joe Gass" <> wrote in message
    > news:...
    > > 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
    > >
    > >
    > >
    > > "simon" <> wrote in message
    > > news:...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
    simon, Dec 4, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Fields
    Replies:
    0
    Views:
    473
    Tony Fields
    Dec 9, 2004
  2. news.rcn.com
    Replies:
    1
    Views:
    9,631
    Chris Smith
    Jul 12, 2004
  3. Sydex
    Replies:
    12
    Views:
    6,453
    Victor Bazarov
    Feb 17, 2005
  4. Replies:
    0
    Views:
    363
  5. andric
    Replies:
    0
    Views:
    428
    andric
    Feb 1, 2008
Loading...

Share This Page