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