Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to change or visible/unvisible controls under repeater control. I want to do in DropDownList Change.
Posted
Comments
Mahesh Bailwal 19-Aug-13 7:59am    
Please provide more information.
Abhilask kumar 19-Aug-13 8:40am    
I have create two control inside repeater control one is dropdownlist second is textbox. and text box visible is false . i want on change of dropdownlist textbox is visible true.
CodeBlack 19-Aug-13 8:05am    
where is dropdown ? inside repeater or outside repeater ?
Abhilask kumar 19-Aug-13 8:32am    
inside repeater control and changeable textbox is also inside.

1 solution

I have created one sample which contains one Repeater and One JavaScript method as shown below :

Repeater :
ASP.NET
<table>
           <asp:repeater runat="server" id="repeaterTest" >
               <itemtemplate>
                   <tr>
                       <td>
                           <asp:dropdownlist runat="server" id="ddlTest" onchange="ManageControl(this.id , this.value)">
                               <items>
                                   <asp:listitem text="Show" value="1"></asp:listitem>
                                   <asp:listitem text="Hide" value="0"></asp:listitem>
                               </items>
                           </asp:dropdownlist>
                           <asp:textbox runat="server" id="textTest"></asp:textbox>
                       </td>
                   </tr>
               </itemtemplate>
           </asp:repeater>
       </table>


JavaScript

JavaScript
<script type="text/javascript">
        function ManageControl(id, selectedValue) {
            var text = document.getElementById(id.replace("ddlTest", "textTest"));
            
            if (selectedValue == "1") {
                text.style.display = "";
            } else {
                text.style.display = "none";
            }
        }
    </script>
 
Share this answer
 
v2

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