C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







Listbox in ASP.NET with # Coding?


Posted Date: 25 Jul 2008      Total Responses: 3

Posted By: Legend of Micro       Member Level: Gold     Points: 1


Hai friends,

My form contains a button , listbox and label

how will u write the code in c#

if the listbox item is only one then i want to print the message as (list box contains only one value)

other wise

print (list box contains more than one value)

how will i write in asp.net with c# coding

Thanks and Regards,
Kugan.T




Responses

Author: suman    25 Jul 2008Member Level: GoldRating:     Points: 4
protected void Button1_Click(object sender, EventArgs e)
{
if (ListBox1.Items.Count == 1)
{
Label1.Text = "list box contains only one value";
}
else
{
Label1.Text = "list box contains more than one value";
}
}



Author: Gaddamchandrakanth    25 Jul 2008Member Level: SilverRating:     Points: 3
Hi,
Please check this once.

if(lstbox.items.count >1)
{
lblMessage.Text = "List box Contains more than one Value");
}
else
{
lblMessage.Text = "List box Contains only one Value");
}

Thanks and Regards
Chandrakanth


Post Reply
You must Sign In to post a response.
Next : how to send the mail in below task using asp.net
Previous : select query in MSSQLSERVER 2000
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing services

Contact Us    Privacy Policy    Terms Of Use