Add a double-click event to the ListBox control in .NET

xiaoxiao2021-03-06  73

I am experiencing a listbox problem in using DOTNET, I have added a ListBox problem: add the selected item to another in another listbox, but the ListBox control itself does not have this event, so how to implement? I thought of the client script JavaScrit, and finally solved this problem by reviewing the relevant information. Now it is written to share with you, I hope to help everyone.

Here are three questions: First: What is the JavaScript code you want to execute? Note: The syntax of JavaScript code is correct, that is, each line must be ";" end; function change () {var address = document.createElement ("option"); var index1; if (Document.form1.Listbox1.Length = = 0) Return (false); index1 = document.form1.listbox1.selectedIndIndex; if (index1 <0) return (false); addOption.text = document.form1.listbox1.Options (index1) .text; addOption.value = Document.form1.listbox1.value; document.form1.listbox2.add (addoption); document.form1.listbox1.remove (index1);} second: How to convert JavaScript code to C # code? public static void ListBox_DblClick (Page page, System.Web.UI.WebControls.WebControl webcontrol, string SourceControlName, string TargetControlName) {SourceControlName = "document.Form1." SourceControlName; TargetControlName = ". document.Form1" TargetControlName; string js = "