Hide or visible of Textbox-Based on RadioButtolist Selection
Hi,
I have one radio buttonlist.Now i've to make visible the textbox,label based on radiobuttonlist selection.Here i attached my code.But can't make visible,hide the label,textboxes.Can anyone help me to solve this. Help me guys..
<asp:Label ID="lblDoctor" runat="server" Text="Doctor's Name : "></asp:Label>
<asp:DropDownList ID="ddlDoctor" runat="server" AutoPostBack="true">
</asp:DropDownList>
<asp:RadioButtonList ID="rblReport" runat="server" RepeatDirection="Horizontal" RepeatLayout="Table" TextAlign="Right">
<asp:ListItem Text="Report By Date" Value="1"></asp:ListItem>
<asp:ListItem Text="Report By Weekly" Value="2"></asp:ListItem>
<asp:ListItem Text="Report By Monthly" Value="3"></asp:ListItem>
</asp:RadioButtonList>
<asp:Label ID="lblDate" runat="server" Text="Date :"></asp:Label>
<asp:TextBox ID="txtDate" runat="server" Width="9%"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDate"
Format="MM/dd/yyyy">
</asp:CalendarExtender>
<asp:Label ID="lblWeek" runat="server" Text="Week"></asp:Label>
<asp:TextBox ID="txtWeek" runat="server" Width="9%"></asp:TextBox>
<asp:Label ID="lblMonth" runat="server" Text="Month :"></asp:Label>
<asp:DropDownList ID="ddlMonth" runat="server">
<asp:ListItem Text="Select" Value="0"></asp:ListItem>
<asp:ListItem Text="January" Value="1"></asp:ListItem>
<asp:ListItem Text="February" Value="2"></asp:ListItem>
<asp:ListItem Text="March" Value="3"></asp:ListItem>
<asp:ListItem Text="April" Value="4"></asp:ListItem>
<asp:ListItem Text="May" Value="5"></asp:ListItem>
<asp:ListItem Text="June" Value="6"></asp:ListItem>
<asp:ListItem Text="July" Value="7"></asp:ListItem>
<asp:ListItem Text="August" Value="8"></asp:ListItem>
<asp:ListItem Text="September" Value="9"></asp:ListItem>
<asp:ListItem Text="October" Value="10"></asp:ListItem>
<asp:ListItem Text="November" Value="11"></asp:ListItem>
<asp:ListItem Text="December" Value="12"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnSubReport" runat="server" Text="Generate Report" OnClick="btnSubReport_Click" />
protected void rblReport_SelectedIndexChanged(object sender, EventArgs e)
{
if (rblReport.SelectedIndex == 1)
{
lblDate.Visible = true;
txtDate.Visible = true;
lblWeek.Visible = false;
txtWeek.Visible = false;
lblMonth.Visible = false;
ddlMonth.Visible = false;
}
else if (rblReport.SelectedIndex == 2)
{
lblWeek.Visible = true;
txtWeek.Visible = true;
lblDate.Visible = false;
txtDate.Visible = false;
lblMonth.Visible = false;
ddlMonth.Visible = false;
}
else if (rblReport.SelectedIndex == 3)
{
lblMonth.Visible = true;
ddlMonth.Visible = true;
lblWeek.Visible = false;
txtWeek.Visible = false;
txtDate.Visible = false;
txtDate.Visible = false;
}
}