Add Client side event to ListBox ??

 Is it possible to add a client event to a listbox?

The desired functionality would be when the user double clicks an item in the ListBox - an alert pops up with the value of the item. Something like I write some javascript for LbxDblClick() and then:

<asp:DropDownList ID="ddlTests" runat="server" Width="168px" Font-Size="12px" onClientDoubleClick="LbxDblClick()">

0
James
2/7/2008 6:26:58 PM
asp.net.client-side 24353 articles. 2 followers. Follow

4 Replies
1104 Views

Similar Articles

[PageSpeed] 50
Get it on Google Play
Get it on Apple App Store

Try this in your Page_Load...

    ddlTest.Attributes.Add("ondblclick", "alert(this.value);")
 
Best regards...
Josh Stodola ← Come check out my blog!
0
JoshStodola
2/7/2008 6:55:42 PM

AFAIK, onClientDoubleClick is not a normal .NET event of a DropDownList. What control set are you using?

But a ListBox and a DropDownList both evaluate to a <select> element, so they should have the same properties and events. Have you tried the same thing on a ListBox?

NC...

0
NC01
2/7/2008 7:00:02 PM

Good afternoon I was able to replicate something similar to what you are looking for but I did it to a GridViewRow by using code similar to this in the RowDataBound Event of the GridView:

 

e.Row.Attributes.Add("onDblclick", "alert('Row " + e.Row.DataItemIndex.ToString() + " double clicked');");
 I am not sure if this will be possible with a dropdownlist since once you click on the item in the list it does not really give you time or the ability to double click it.
--------------------------------------------------
Sincerely,
Michael Reyeros

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

If my solution doesn't solve your problem, just feel free to mark it as not answer and reply.
0
mreyeros
2/7/2008 7:08:20 PM

Thanks Josh - this worked great. 

JoshStodola:

Try this in your Page_Load...

    ddlTest.Attributes.Add("ondblclick", "alert(this.value);")
 
Best regards...
0
James
2/7/2008 9:00:40 PM
Reply:

Similar Artilces:

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click (Asp.net) and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

Help with client side events Vs. server side events
Hi, Can someone look as the following script and tell me why marking the check box doesn't generate a client side event eventhough there's: onclick="checkClick()"? marked.  Thanks in advance, Sivan <%@ Page Language="c#" %><HTML> <HEAD>  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body>  <SCRIPT language="c#" runat="Server">  void Page_Load(object s, EventArgs e) {  if (!Page.IsPostBack)  {   Label1.Text = Label...

Client side/server side event race.
 Hi.  I've got a page that 1) Takes some text fields as input2) Does some math calculations on the input (server side via a "calculate" button click)3) Then opens a new window with some detailed information (client side, via a "view report" button click)The server needs to "calculate" before the user can click "view report" so I start with "view report" disabled.  I've got input validation on the "calculate" click, and at the end, I enable the "view report" button.  Everything is working well wi...

Client Side events and Server side binding
I want to filter a dataset, server side and bind it to a select control. Problem is my filtering must be done based on the text written by the user in a text input. To get this text i'm using client side keyboard events. I tried to use client side binding and it works fine, but the problem is my dataset has more than 10000 rows, and so the performance is awful. Only thing i can do i think is to rebind the select control to a filtered dataset, improving performance. This is my code at the moment: In the aspx: static HtmlSelect _control = null; [WebMethod(EnableSession = true)] publi...

List of client side function of extenders and controls for client side
Hello All,I am using AJAX control toolkit for my current project. Now I need to find out what client side functions I can call on an extender. Lets say I am using a PopControlExtender. Now I want to show the popup from a JS funtions.If I can do a guess then it would be something like this$find('ppce').show();From where I can find what client side functions I can call on those extensders. This is really a frusterating thing. I learn about extenders only from Learn tutorials, no help here and there. Can anybody please tell me where are documentations about all the extenders in the tool...

Stop execution of server side event from client side
Dear All  I have a text box and i wrote code on the server side event( On Text Change). So when i write something on the text box it goes to server and execute the server side code. Now i want to control this sever execution from client side. i mean i want to cancel this postback from client side under some conition. can anyone plz help me? Regards Sure if you let us know what you want to be done. here is an example <asp:textbox id="txtFile" OnTextChanged="javascript:RefreshPage();" Visible=true Width=500 Runat=server/> function RefreshPage() { &nb...

Jscript, moving from client-side to server-side (.NET)
Hey all I’m working translating a web-app written in client-side Jscript to run on the server-side as JScript.NET. Without needing to get too specific, I am using Jscript because the original page aggregated raw data to produce statistical results (this was done dynamically based on user 'sort-by' options). The final output is an html report that can be emailed. Because this is currently being done on the client side, as the raw data grows the load-time grows as well (to the point that has almost become unusable). I’m posting here to see if anyone has any experi...

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in asp.net ( required field, range validator and others)..my question is the required field validator is a server side control. So does that mean that it does a post back?..is it client side or server side control  The only controls that post back are buttons and other inputs where you set AutoPostback="True", such as a dropdownlist or a textbox.  Another way of posting back is using an UpdatePanel and placing a trigger in it for a specified control and/or event. All controls are considered clien...

Calling server-side methods from client-side event
Hello,i'm novice in asp.net client-side script and i have a simple question: is it possibile to call a server-side method (ex. c# managed code) from a java script client-side function linked to an event?Thanks all  Luca GuccioneGenova, Italy Yes you can. It's very easy using web methods from code behind, jquery and the script manager. See this very good blog post explaining the steps: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ mySoZa lucaguccione: Hello, i'm novice in asp.net client-side script and i have a simple quest...

doing client-side action after server-side event ends
 I have a asp-button;I want it to perform a client-side action after completion of the sever-side action((like:calling a javascript function after the click event of the button ends); You can inject some javascript from the server side button click event so that when the page renders on the client side it will invoke the function or javascript fragment. You can use the method Page.RegisterStartupScript to inject javascript, or you can assign the javascript fragment to a literal control which would be interpreted when the page renders on client side.  Can u add some code snippe...

Server Side control invoking a Client Side event
I need to figure out how to get a server side control to process the "OnMouseOver" event. Since server side controls do not have the onmouseover event associated with them, how would you make for example, a DropDownList have a "OnMouseOver" event associate with it? The DropDownList must be server side. I guess the idea here is to set client-side events on the server-side control. Any help will be appreciated. You may try something like this: In server side code DDL1.Attributes.Add("onmouseover", "javascript:alert('Hi')") Th...

How can you raise server side event from client side
Let's say I have an event on server side that handles button_click. how can I raise that event from client side using AJAX. You can create a script in a string variable, and register withScriptManager.RegisterStartupScript http://msdn.microsoft.com/en-us/library/bb359558.aspx string script = "alert('ciao!')";ScriptManager.RegisterStartupScript( this, this.GetType(), "Alert", script, true );If this answers your question, please select 'mark as answer' thanks!Andrea DottorMicrosoft MVP - ASP/ASP.NEThttp://blog.dottor.net For buttons you can use JQu...

Call client side and server side events together.
I have one textbox on my aspx page.I want to validate amount in that textbox. If it exceeds 100 then the alert message should show that amount is bigger.And it should not go further. But if the amount is less than or equal to 100, then after checking the condition onclientside, it should to the server side TextChanged event.I have written a javascript function which is being called on "onchange" event of textbox and if the value is valid, then it should call serverside textchanged event of the same textbox.Please its urgent. Mark it as Answer if you find it Helpful.Shailen  ...

Accessing server-side variables from client-side events
This is a multi-part message in MIME format. ------=_NextPart_000_00E8_01C04D70.7EAC7080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable In a client-side itemchanged function, how can I set a server-side = variable?? I simply need to execute the following: psSession.SetValue("userID", user_id); I'm sure there's a way to trigger server-side script and pass in = variables. Any suggestions?? Thanks. ------=_NextPart_000_00E8_01C04D70.7EAC7080 Content-Type: text/html; charset="iso-8859-1" ...

Web resources about - Add Client side event to ListBox ?? - asp.net.client-side

Listbox • Email Marketing
... marketing services, where you can create your campaign in our online composer or from your own email program like Outlook or Mac Mail. Listbox ...

ListBox - To-Do + Birthdays on the App Store on iTunes
Get ListBox - To-Do + Birthdays on the App Store. See screenshots and ratings, and read customer reviews.

Windows Phone Mango change, Listbox: How to detect compression(end of scroll) states ?
... applications performance on mobile. [ Update : This is available after Beta2(Trial) build. Wait for RC/RTM builds] If you’ve ever used a ListBox ...

Listbox, Why Art Thou Blanking?
One of the biggest performance changes for developers using Silverlight in Mango (WP 7.5) is off-thread input for ListBox. In a nutshell this ...

Styling and DataBinding Silverlight 4.0 ListBox
In the latest version of my Podcast Aggregator application I’ve spent lots of time playing around with styling the standard Silverlight ListBox. ...

Stack Overflow
Q&A for professional and enthusiast programmers

bada - Wikipedia, the free encyclopedia
2.0.5 SDK / March 15, 2012 ; 2 months ago ( 2012-03-15 ) Bada (stylized as bada ; Korean : 바다 ) is an operating system for mobile devices such ...

Ballard Tote Bags - Ballard Designs
{"bundleMinimumPrice":20.0,"bundleMaximumPrice":25.0,"bundleMinimumListPrice":0.0,"bundleMaximumListPrice":0.0,"xPriceLabel":null,"currencyC ...

How suitable is Windows 8 Metro for business developers?
... sometimes conflict with each other. One thing I really don't like in Windows 8 when running desktop apps is how when you scroll in a listbox ...

CodeGuru - Microsoft developers related ideas, articles, tips, tricks, comments, downloads, and so much ...
CodeGuru is where developers can come to share ideas, articles, questions, answers, tips, tricks, comments, downloads, and so much more related ...

Resources last updated: 11/24/2015 2:38:00 AM