ListBox Control
ListBox Control
The ListBox Web server control displays a list of items from which we can make a selection. We can select one or more items from the list of items displayed. The class hierarchy for this control is as follows:
Object
Control
WebControl
ListControl
ListBox
Properties::
Items:Gets/Sets the collection of items in the control
Rows:Gets/Sets the number of rows in the list box
SelectionMode:Gets/Sets the list box's selection mode, can be set to single or multiple
ListBox Control
**************************************************************************
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ListBox.aspx.cs" Inherits="_Default" %>
ListBox Control
************************************************************************
Cs Code
*********************************************************************
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Show_Click(object sender, EventArgs e)
{
TextBox1.Text = "You Selected::" + SingleSelected.SelectedItem.Text;
}
}