Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

displaying checkbox item in textbox

$
0
0

 protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string a = string.Empty;

              
        foreach (ListItem li in CheckBoxList1.Items)
        {
            
            if (li.Selected == true)
            {

                
                a += li.ToString() + ",";
                
            }
          
        }
     
        a = a.TrimEnd(',');
        TextBox1.Text = a;
    }
    The order of the item is not maintained. When I deselect any item from checkbox all items rearragens starting from the first item of checkbox. I want the orderj of selection  to be maintanined on deselection.

Thanks.


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>