Add the sample code for the double click event to the ListBox
- 2020-03-30 00:42:10
- OfStack
<!-- To create a JS call button the click The event -->
<script type="text/javascript">
function JsListChangeItem() {
document.getElementById("buttonShow").click();
}
</script>
<!-- Create a hidden button To create a double-click event --->
<asp:Button ID="buttonShow" runat="server" onclick="buttonShow_Click" Text="Button" style="display:none"/>
<!-- double-click listbox-->
<asp:ListBox ID="listBox1" runat="server"Height="226px" Width="211px" AutoPostBack="True"></asp:ListBox>
.cs
protected void Page_Load(object sender, EventArgs e)
{
listBox1.Attributes.Add("ondblclick", "JsListChangeItem()");//Add a double-click event to listBox1.
}