Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
ddlroom.Text = ""
txtrow.Text = ""
txtcolumn.Text = ""
txtstrength.Text = ""



i an using this for clear the value of textbox. but how cam i clear the selected checkbox in checkboxlist.
Posted

C#
public void CleareAllcontrolsRecursive(Control container)
    {
        foreach (var control in container.Controls)
        {
            if (control is TextBox)
            {
                ((TextBox)control).Text = string.Empty;
            }
            if (control is DropDownList)
            {
                ((DropDownList)control).SelectedValue = "0";
            }
            if (conntrol is CheckBox)
            {
                ((CheckBox)control).Checked = false;
            }
        }
    }


call this method button click ,after inserting the data...

CleareAllcontrolsRecursive(panel1);


in your body tag...contails "panel1" tag
<asp:form id="form1" runat="server" xmlns:asp="#unknown">
<asp:panel id="panel1" runat="server">
....controls tags...

 
Share this answer
 
Try this in button click event:
VB
For Each li As ListItem In CheckBoxList1.Items
	li.Selected = False
Next
 
Share this answer
 
v3

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