copying selected items from checkboxlist to another checkboxlist

Posted by Sanoop under VB.NET on 12/5/2011 | Points: 10 | Views : 2234 | Status : [Member] | Replies : 1
Hi friends,
I want to know how to copy only selected items from checkboxlist1 to another ckeckboxlist 2.
I'm asking the code while using toolbar




Responses

Posted by: Varung on: 12/6/2011 [Member] Starter | Points: 25

Up
0
Down
add below code in aspxpage

<asp:CheckBoxList ID="CheckBoxList1" runat="server">
</asp:CheckBoxList>

add below code in the click event of any control

foreach(Control ctrl in Form.Controls)
{
if (ctrl.GetType().ToString().Equals("System.Web.UI.WebControls.CheckBox"))
{

CheckBox id = (CheckBox)ctrl;
if (id.Checked)
{
CheckBoxList1.Items.Add(id.Text);
CheckBoxList1.DataBind();

}

G.Varun

Sanoop, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response