Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a asp page with asp:checkboxlist contains 38 listboxes.. if i select any List box It will display the listbox item name in Lable.

Stored Proc--- Exec Report.usp_getlistboxitems
Datafileds --- ID, ListITEMS

Issue:--- If i select the listbox it is displaying "ListITEMS" but i want corresponding "ID" field in that lable.

codebehind --
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
    Label1.Text = string.Empty;

    foreach (ListItem listitem in CheckBoxList1.Items)
    {
        if (listitem.Selected)
            Label1.Text += listitem.Text + " ";
    }
}
Posted
Updated 1-Jun-12 6:59am
v2

1 solution

just change this part of your code:
C#
Label1.Text += listitem.Value + " ";
 
Share this answer
 
Comments
myansweris 1-Jun-12 14:31pm    
Superb it's working ...TQ

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900