473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Firing a function on a doubleclick event

Hey All,

I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default, and I know
it will work with Javascript, but how do I use javascript to run a server
side function? Currently, I am using a Next button to accept the change, but
it would be a faster UI to have the option to doubleclick instead.

thanks a ton!
david lozzi
Nov 19 '05 #1
5 3120
Hey David,
I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default,
I assume you mean a server side event? In that case you can enable the
autopostback of the listbox. You can then double click it and get the default
event. For example:

private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
string[] astr = new string[] {"a","b","c"};
this.ListBox1.DataSource = astr;
this.ListBox1.DataBind();
}
}

private void ListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.Label1.Text = this.ListBox1.SelectedValue;
}

"David Lozzi" wrote:
Hey All,

I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default, and I know
it will work with Javascript, but how do I use javascript to run a server
side function? Currently, I am using a Next button to accept the change, but
it would be a faster UI to have the option to doubleclick instead.

thanks a ton!
david lozzi

Nov 19 '05 #2
Let me start by answering your question. JavaScript is on the client. The
function you want to call is on the server. Therefore, to fire a function
with a JavaScript, the JavaScript needs to post the form back to the server.

Now, I can't help but think that your idea lacks some merit. Why? Because
browsers behave in known ways. When you write an app that runs in a browser,
you must expect that most people who use it will be familiar with browsers,
HTML documents, and web sites. They don't expect a double-click to fire
anything. This impacts usability. It is better to stick with the conventions
that people are used to. IMHO, changing the behavior of the browser will
only confuse people.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"David Lozzi" <dlozzi@(remove)delphi-ts.com> wrote in message
news:eo**************@TK2MSFTNGP09.phx.gbl...
Hey All,

I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default, and I
know it will work with Javascript, but how do I use javascript to run a
server side function? Currently, I am using a Next button to accept the
change, but it would be a faster UI to have the option to doubleclick
instead.

thanks a ton!
david lozzi

Nov 19 '05 #3
Thank you for your input. I am fully aware of Javascript and client/server
side functions. This is why I am asking how to access/post/request/fire off
a server event from javascript. The ondoubleclick event is client side only.
I am needing to create the doubleclick event because my client's existing
application that I am replacing uses doubleclick events to select items. And
regarding what most people are familiar with, every user I have worked with
doubleclick every day, and I'd imagine you do too (open files and programs
in your OS). Weaker users doubleclick everything on websites because thats
what they know from the operating system. I am into pleasing the customer
and idiot proofing as much as possible.

Thanks again,

David Lozzi

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Let me start by answering your question. JavaScript is on the client. The
function you want to call is on the server. Therefore, to fire a function
with a JavaScript, the JavaScript needs to post the form back to the
server.

Now, I can't help but think that your idea lacks some merit. Why? Because
browsers behave in known ways. When you write an app that runs in a
browser, you must expect that most people who use it will be familiar with
browsers, HTML documents, and web sites. They don't expect a double-click
to fire anything. This impacts usability. It is better to stick with the
conventions that people are used to. IMHO, changing the behavior of the
browser will only confuse people.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"David Lozzi" <dlozzi@(remove)delphi-ts.com> wrote in message
news:eo**************@TK2MSFTNGP09.phx.gbl...
Hey All,

I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default, and I
know it will work with Javascript, but how do I use javascript to run a
server side function? Currently, I am using a Next button to accept the
change, but it would be a faster UI to have the option to doubleclick
instead.

thanks a ton!
david lozzi


Nov 19 '05 #4
This fires even when I single click on the list box.

Can I point to or cause a server side function to fire?

Thanks,

David Lozzi
"Tim Stall" <Ti******@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
Hey David,
I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default,


I assume you mean a server side event? In that case you can enable the
autopostback of the listbox. You can then double click it and get the
default
event. For example:

private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
string[] astr = new string[] {"a","b","c"};
this.ListBox1.DataSource = astr;
this.ListBox1.DataBind();
}
}

private void ListBox1_SelectedIndexChanged(object sender, System.EventArgs
e)
{
this.Label1.Text = this.ListBox1.SelectedValue;
}

"David Lozzi" wrote:
Hey All,

I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default, and I
know
it will work with Javascript, but how do I use javascript to run a server
side function? Currently, I am using a Next button to accept the change,
but
it would be a faster UI to have the option to doubleclick instead.

thanks a ton!
david lozzi

Nov 19 '05 #5
Okay, I think I see it: You have a client side function, and you want that to
call a Server-side function? If so, maybe this page will help:
Passing client data to the server
http://timstall.dotnetdevelopersjour...ad/1118970.htm

Essentially it shows how to have a client side function pass data back to
the server via (1) setting a runat=server hidden field, and (2) submitting
the form.

"David Lozzi" wrote:
This fires even when I single click on the list box.

Can I point to or cause a server side function to fire?

Thanks,

David Lozzi
"Tim Stall" <Ti******@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
Hey David,
I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default,


I assume you mean a server side event? In that case you can enable the
autopostback of the listbox. You can then double click it and get the
default
event. For example:

private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
string[] astr = new string[] {"a","b","c"};
this.ListBox1.DataSource = astr;
this.ListBox1.DataBind();
}
}

private void ListBox1_SelectedIndexChanged(object sender, System.EventArgs
e)
{
this.Label1.Text = this.ListBox1.SelectedValue;
}

"David Lozzi" wrote:
Hey All,

I have a listbox that I would like to fire an event on doubleclick. the
onDoubleClick property of the listbox isnt available be default, and I
know
it will work with Javascript, but how do I use javascript to run a server
side function? Currently, I am using a Next button to accept the change,
but
it would be a faster UI to have the option to doubleclick instead.

thanks a ton!
david lozzi


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: René Meinecke | last post by:
hi there, i want to raise an event, for example a DoubleClick-Event of a DataGrid, but i do not want to call a function which is event handler. Right now i do it like this: void...
2
by: JoeHenrich | last post by:
I am using VS.NET 2003 and am having an interesting issue with a Listbox control. Essentially, I have a form with a listbox on it. In the listbox doubleclick event I would like to do some...
0
by: Koo Min | last post by:
Hello, I've added drag-and-drop feature to a windows forms label control which is contained in a panel. And I added a doubleclick event handler to the drag-and-drop-abled label, but doubleclick...
4
by: Tor Inge Rislaa | last post by:
DoubleClick in DataGrid Hi I have a Datagrid bound to a dataset that I want to write a DoubleClick procedure on. My problem is that the DoubleClick event is raised only when DoubleClicking the...
1
by: Tom | last post by:
Hi I have a listview with an event for mousemove and double click. Since implementing a handler for the mousemove event the double click event never gets fired, can anyone tell me how i should...
3
by: LCAdeveloper | last post by:
Help! A trawl through the archives couldn't shed any light on this, so is there a way to handle DoubleClick events for RadioButtons in vb.NET? I'm recoding a VB4 application, which used the...
3
by: C Glenn | last post by:
I would like one DoubleClick event handler to handle all double clicks throughout a DataGrid. I've assigned a DoubleClick event handler to the DataGrid and it works nifty-spiffy so long as I click...
4
by: _DD | last post by:
TrackBar DoubleClick event is not accessible via the Control Properties event pane. So I tried adding the handler directly: this.ColTrackBar.DoubleClick += new...
1
by: bigijoseph | last post by:
Please help : page load event is not firing. -------------------------------------------------------------------------------- Hi, I am a new to .net. I am trying to learn it. I tried the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.