Hi ShakthiV,
You have to use style="display: none" instead of Visible property.
Then set the Attributes as per the condition.
Check this example. Now please take its reference and correct your code.
HTML
<asp:RadioButton ID="RadioButton1" Text="Group A" runat="server" AutoPostBack="true" GroupName="g1" />
<asp:RadioButton ID="RadioButton2" Text="Group B" runat="server" AutoPostBack="true" GroupName="g1" />
<p style="display: none" id="pTextBox1" runat="server">
1: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</p>
<p style="display: none" id="pTextBox2" runat="server">
2: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p style="display: none" id="pTextBox3" runat="server">
3: <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</p>
<p style="display: none" id="pTextBox4" runat="server">
4: <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</p>
<p style="display: none" id="pTextBox5" runat="server">
5: <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</p>
<br />
<asp:Button Text="Check" runat="server" OnClick="OnCheck" />
Code
C#
protected void OnCheck(object sender, EventArgs e)
{
pTextBox1.Attributes["style"] = "display:none";
pTextBox2.Attributes["style"] = "display:none";
pTextBox3.Attributes["style"] = "display:none";
pTextBox4.Attributes["style"] = "display:none";
pTextBox5.Attributes["style"] = "display:none";
if (RadioButton1.Checked)
{
pTextBox1.Attributes["style"] = "display:block";
pTextBox4.Attributes["style"] = "display:block";
pTextBox5.Attributes["style"] = "display:block";
}
else
{
pTextBox1.Attributes["style"] = "display:none";
pTextBox4.Attributes["style"] = "display:none";
pTextBox5.Attributes["style"] = "display:none";
}
if (RadioButton2.Checked)
{
pTextBox3.Attributes["style"] = "display:block";
pTextBox5.Attributes["style"] = "display:block";
}
else
{
pTextBox3.Attributes["style"] = "display:none";
pTextBox5.Attributes["style"] = "display:none";
}
}
VB.Net
Protected Sub OnCheck(ByVal sender As Object, ByVal e As EventArgs)
pTextBox1.Attributes("style") = "display:none"
pTextBox2.Attributes("style") = "display:none"
pTextBox3.Attributes("style") = "display:none"
pTextBox4.Attributes("style") = "display:none"
pTextBox5.Attributes("style") = "display:none"
If RadioButton1.Checked Then
pTextBox1.Attributes("style") = "display:block"
pTextBox4.Attributes("style") = "display:block"
pTextBox5.Attributes("style") = "display:block"
Else
pTextBox1.Attributes("style") = "display:none"
pTextBox4.Attributes("style") = "display:none"
pTextBox5.Attributes("style") = "display:none"
End If
If RadioButton2.Checked Then
pTextBox3.Attributes("style") = "display:block"
pTextBox5.Attributes("style") = "display:block"
Else
pTextBox3.Attributes("style") = "display:none"
pTextBox5.Attributes("style") = "display:none"
End If
End Sub
Screenshot