How to use Listbox control in ASP.Net Archives - Tech Insights https://reactconf.org/category/how-to-use-listbox-control-in-asp-net/ Unveiling Tomorrow's Tech Today, Where Innovation Meets Insight Mon, 27 Oct 2014 17:46:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://i0.wp.com/reactconf.org/wp-content/uploads/2023/11/cropped-reactconf.png?fit=32%2C32&ssl=1 How to use Listbox control in ASP.Net Archives - Tech Insights https://reactconf.org/category/how-to-use-listbox-control-in-asp-net/ 32 32 230003556 How to use Listbox control in ASP.Net https://reactconf.org/how-to-use-listbox-control-in-aspnet10/ https://reactconf.org/how-to-use-listbox-control-in-aspnet10/#comments Mon, 27 Oct 2014 17:46:00 +0000 http://www.sqlneed.com/2014/10/27/how-to-use-listbox-control-in-asp-net/ In this article I will explain you how to Select multiple item  in Listbox control in asp.net using c#. //Design Source Code <%@ PageLanguage=”C#”AutoEventWireup=”true”CodeFile=”Default.aspx.cs”Inherits=”_Default”%> <!DOCTYPE htmlPUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” …

The post How to use Listbox control in ASP.Net appeared first on Tech Insights.

]]>

In this article I will explain you how to Select multiple item  in Listbox control in asp.net using c#.

//Design Source Code
<%@ PageLanguage=”C#”AutoEventWireup=”true”CodeFile=”Default.aspx.cs”Inherits=”_Default”%>
<!DOCTYPE htmlPUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
    <title>ListBox Example</title>
    
</head>
<body>
    <form id=”form1″ runat=”server”>
    
    <div>
   
     <asp:ListBox id=”ListBox1″
       Rows=”5″
       width=”150px”
       SelectionMode=”Multiple”
       runat=”server”>
        <asp:ListItem>ASP.Net </asp:ListItem>
        <asp:ListItem>C# .Net </asp:ListItem>
        <asp:ListItem>VB.Net </asp:ListItem>
        <asp:ListItem>HTML </asp:ListItem>
        <asp:ListItem>JAVA </asp:ListItem>
        </asp:ListBox>
       
<asp:Button ID=”Button1″ runat=”server” onclick=”Button1_Click” Text=”Show” Width=”64px” />
       
        <br/>
        <br/>
       
        <asp:Label ID=”Label1″ runat=”server”/>
              
      
    </div>
    </form>
</body>
</html>
//C# Source Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partialclass _Default: System.Web.UI.Page
{
    protected voidPage_Load(object sender, EventArgs e)
    {
    }
    protected voidButton1_Click(object sender, EventArgs e)
    {
       
        foreach (ListItemlv in ListBox1.Items)
        {
            if (lv.Selected)
            {
                Label1.Text += lv.Text +“<br/>”;
            }
        }
      
        }
   
}

Hold the Control key when selecting multiple item in listbox

The post How to use Listbox control in ASP.Net appeared first on Tech Insights.

]]>
https://reactconf.org/how-to-use-listbox-control-in-aspnet10/feed/ 1 2237