Link to home
Create AccountLog in
Avatar of solution1368
solution1368

asked on

asp.net, jquery show and hide

Any ideas why the asp:panel does not show?
(If I take out PanelProductionEquipmentCreateAnotherperiodTime.Visible = false;
it will work, but I need to default to invisible. in addition, I try to make the asp:panel invisible in the aspx code in the front end. it does not work neither.)

need some experts help....how to fix it.


<asp:CheckBox runat="server" ID="ProductionEquipmentCreateAnotherperiodTime" Text="Check to create another period time" /></td>
<script type="text/javascript">
    $("#<%=ProductionEquipmentCreateAnotherperiodTime.ClientID%>").change(function () {
        var rbvalue = $(this).is(":checked");
        if (rbvalue) {
            $('#<%= PanelProductionEquipmentCreateAnotherperiodTime.ClientID %>').show('slow');
        }
        else {
            $('#<%= PanelProductionEquipmentCreateAnotherperiodTime.ClientID %>').hide('slow');
        }

    });
</script>

<asp:Panel runat="server"   ID="PanelProductionEquipmentCreateAnotherperiodTime">
<asp:TextBox Width="200"  runat="server" ID="ProductEquipmentAnotherPeriodOfTime"></asp:TextBox>
</asp:Panel>


protected void Page_Init(object sender, EventArgs e)
        {
            PanelProductionEquipmentCreateAnotherperiodTime.Visible = false;
        }
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of solution1368
solution1368

ASKER

anyway working around? I have alot of panels flying around different webpages....
if all your panel have <<< Panel >> in their name you may use jQuery :

<script type="text/javascript">
$(document).ready(function() {
   $("div[id*=Panel]").hide(); // HIDE ALL DIV WHERE ID HAVE Panel in their name
});
</script>

Open in new window