2
Answers

short checkboxlist

Photo of Dharmesh sharma

Dharmesh sharma

14y
1.8k
1
hi


in my webpage have two checkboxlist1 and checkboxlist 2

in checkboxlist1 i click one item then item is remove from checkboxlist and add into checkboxlist2

now again i click in checkboxlist2 the item delete from 2 and add into 1 chekboxlist but

item add in last and not short 

how to short the checkbox list after add any item


please help me......

Answers (2)

7
Photo of Dharmesh sharma
NA 752 688.6k 14y
at last i got is solution of this problem



Use the using System.Collections namespaces

and add checkbox to Sortedlist class and bind to the checkboxlist;


here is code


SortedList sortedlist = new SortedList();
        for (int i1 = 0; i1 < chk_1.Items.Count; i1++)
        {
            sortedlist.Add(chk_1.Items[i1].Value, chk_1.Items[i1].Text);
        }
        chk_1.DataSource = sortedlist;
        chk_1.DataTextField = "Value";
        chk_1.DataValueField = "Key";
        chk_1.DataBind();




Thanks Dharmesh

hai hai hia hai

0
Photo of Manikavelu Velayutham
NA 9.1k 1.6m 14y
Very Good..............Keep It Up..........