Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Clicks and double-clicks

Reply
Thread Tools

Clicks and double-clicks

 
 
PontiMax
Guest
Posts: n/a
 
      07-14-2004
Hi,

is it possible to distinguish between clicks and double-clicks occuring on datagrid rows?

If a single row is clicked it should be selected in order to allow various operations like deleting the row, duplicating it, etc.

If a row is double-clicked another event handler should be called that transfers the user to a details page.

Is there a workaround for this using JavaScript?

Thanks in advance,
P.
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      07-14-2004
There is a sequence of events that fire when a row is double-clicked. That
is onmousedown, onmouseup, onclick, onmouseup and finally ondblclick.

If you need to handle events preceding to ondblclick, you should do it on
client side. Then there is no contradiction between row selecting in onclick
and opening another form in ondblclick.

Eliyahu

"PontiMax" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> is it possible to distinguish between clicks and double-clicks occuring on

datagrid rows?
>
> If a single row is clicked it should be selected in order to allow various

operations like deleting the row, duplicating it, etc.
>
> If a row is double-clicked another event handler should be called that

transfers the user to a details page.
>
> Is there a workaround for this using JavaScript?
>
> Thanks in advance,
> P.



 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      07-14-2004
OK, that previous post should help you. document.getElementById can't raise
an error, it either find the element or not. The error could be caused by
trying to access non-existent properties of the element. For example, you
assumed the element to be an <input> but it is a <span>.

The direction is to create event handlers in javascript on client side and
to setup attributes on server side. Client side onclick event should save
the id of the row selected in a hidden <input>. Usually it also changes the
row style to distinguish between selected and unselected rows. To delete the
selected row, you would have an asp.net button. On the postback, the
server-side code would get the id from the hidden input and delete the
record with that id.

So, the onclick event only saves the id and changes the style. When the
ondblclick handler gets called, it just submits the form (form.submit() can
be used) and the server-side code again gets the id of the record to edit
from the hidden input.

Sorry if it is messy, the task is a bit involving.

Eliyahu

"PontiMax" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Eliyahu,
>
> thanks for your reply!
>
> Unfortunately I don't have a clue how to translate your advices into code.

Are there any working examples on the net?
>
> By the way: I've found an older post where you've recommended the use of

hidden fields and javascript event handlers:
>
> Server-side code:
> ...
> e.Item.Attributes["ondblclick"] = "onDblClick(this)";
> ...
>
> Client-side code:
>
> function onDblClick(row) {
> document.getElementById("inpRowId").innerText=row. cells(0).innerText;
> document.getElementById("btnEdit").click();
> }
>
> Sad to say that this doesn't work for my user control.

"document.getElementById raises an error...
>
> Thanks,
> P.
>
>
>
> "Eliyahu Goldin" wrote:
>
> > There is a sequence of events that fire when a row is double-clicked.

That
> > is onmousedown, onmouseup, onclick, onmouseup and finally ondblclick.
> >
> > If you need to handle events preceding to ondblclick, you should do it

on
> > client side. Then there is no contradiction between row selecting in

onclick
> > and opening another form in ondblclick.
> >
> > Eliyahu
> >
> > "PontiMax" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi,
> > >
> > > is it possible to distinguish between clicks and double-clicks

occuring on
> > datagrid rows?
> > >
> > > If a single row is clicked it should be selected in order to allow

various
> > operations like deleting the row, duplicating it, etc.
> > >
> > > If a row is double-clicked another event handler should be called that

> > transfers the user to a details page.
> > >
> > > Is there a workaround for this using JavaScript?
> > >
> > > Thanks in advance,
> > > P.

> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tkinter, scale widget, and mouse clicks John Fouhy Python 2 06-25-2004 12:49 AM
CD-Rom just clicks and whirrs Daddio Computer Information 3 02-02-2004 06:55 PM
Cd -Rom Clicks and Whirrs Daddio Computer Information 1 02-02-2004 05:46 PM
Q. Liteonit CD and Nero Express software. Music makes clicks and pops. Jim Jones Computer Support 0 01-01-2004 04:45 PM
XP and Hard Disk clicks Norbert Dentressangle Computer Support 4 12-30-2003 07:35 PM



Advertisments