Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am developing a form in which i want to make some controls invisible but when some one of the checkbox is clicked it should become visible my code is:



XML
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
          <asp:ListItem Value="CheckBoxList1"  Text="Multiple Choice"></asp:ListItem>
          <asp:ListItem Value="CheckBoxList2"  Text="True/False"></asp:ListItem>
          <asp:ListItem Value="CheckBoxList3"  Text="Multline"></asp:ListItem>
      </asp:CheckBoxList>


and my other options are:
XML
<br />
  <asp:CheckBox ID="CheckBox1" runat="server" />
  <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
  <br />
  <asp:CheckBox ID="CheckBox2" runat="server" />
  <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
  <br />
  <asp:CheckBox ID="CheckBox3" runat="server" />
  <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
  <br />
   <asp:Label ID="Label3" runat="server" Text="Options:"></asp:Label>



  <br />
  <asp:CheckBox ID="CheckBox4" runat="server" />
  <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
  <br />
  <asp:CheckBox ID="CheckBox5" runat="server" />
  <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
  <br />

  <asp:Label ID="Label4" runat="server" Text="Options:"></asp:Label>



<br />
  <asp:TextBox ID="TextBox6" runat="server" TextMode="MultiLine"></asp:TextBox>
  <br />


i want that if multiple choice checkbox is checked the first four checkbox should be visible but the second two should not visible but if true false is selected then i should see only two checkboxces. how this can be done in asp.net.c# plz help me
Posted
Comments
Sergey Alexandrovich Kryukov 4-Jul-13 23:47pm    
Not a question. Help with what? Is there a problem? What problem?
—SA
irfanniazi 5-Jul-13 0:12am    
i want to make some controls visible and other invisible depending on the checkbox being selected.kindly can you share some tutorial in which shows how to make some portion of a form visible on the basis of which checkbox is selected.

1 solution

XML
User OnSelectedIndexChanged for checkList.
and code on that even like this:

<pre lang="cs">protected void checkList_SelectedIndexChanged(object sender, EventArgs e)
    {
        //loop through checkBoxList to select selected items

            if (aListItem[1].checked)
            {
               //Yoru code for which checkbox you want to visible true and false
            }
            else if (aListItem[2].checked)
            {
               //Yoru code for which checkbox you want to visible true and false
            }

    }</pre>

Accept as answer and vote if help to you.
 
Share this answer
 

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