I have a TextBox, Button and CheckBoxList. If I click the checkbox and click the Button the value is displayed in TextBox. My TextBox is Autocomplete TextBox. if I select the value from auto complete that value in the CheckBoxList is removed. Here is my code:
public void ListBox()
{
lstCheckBoxList.DataSource = s.sqlconn("select CityName from City");
lstCheckBoxList.DataValueField = "CityName";
lstCheckBoxList.DataBind();
}
protected void button1_Click(object sender, EventArgs e)
{
ListBox();
foreach (ListItem li in lstCheckBoxList.Items)
{
if (li.Selected)
{
txtPracticeGroup.Text+= li.Text+ "; ";
}
}
}
Aucun commentaire:
Enregistrer un commentaire