How to loop trough radiobuttonlist and if selected show contentHow do you get the index of the current iteration of a foreach loop?How to loop through all enum values in C#?How to tell RadioButtonList to NOT generate a tableLooping through TextBoxes and RadioButtonListsSet Radiobuttonlist Selected from CodebehindRadiobuttonlist selected valueHow do you set the Content-Type header for an HttpClient request?RadioButtonList selected value with databaseHow to get radiobuttonlist selected valuechange formview databound label text

If a character has darkvision, can they see through an area of nonmagical darkness filled with lightly obscuring gas?

2.8 Why are collections grayed out? How can I open them?

Is it better practice to read straight from sheet music rather than memorize it?

A social experiment. What is the worst that can happen?

How can I block email signup overlays or javascript popups in Safari?

Start making guitar arrangements

Not using 's' for he/she/it

What should you do when eye contact makes your subordinate uncomfortable?

How to explain what's wrong with this application of the chain rule?

Are paving bricks differently sized for sand bedding vs mortar bedding?

lightning-datatable row number error

How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?

Fear of getting stuck on one programming language / technology that is not used in my country

How much character growth crosses the line into breaking the character

How to implement a feedback to keep the DC gain at zero for this conceptual passive filter?

The screen of my macbook suddenly broken down how can I do to recover

Why did the EU agree to delay the Brexit deadline?

How did Rebekah know that Esau was planning to kill his brother in Genesis 27:42?

Symbol used to indicate indivisibility

Non-trope happy ending?

What should you do if you miss a job interview (deliberately)?

What does chmod -u do?

Biological Blimps: Propulsion

Is the U.S. Code copyrighted by the Government?



How to loop trough radiobuttonlist and if selected show content


How do you get the index of the current iteration of a foreach loop?How to loop through all enum values in C#?How to tell RadioButtonList to NOT generate a tableLooping through TextBoxes and RadioButtonListsSet Radiobuttonlist Selected from CodebehindRadiobuttonlist selected valueHow do you set the Content-Type header for an HttpClient request?RadioButtonList selected value with databaseHow to get radiobuttonlist selected valuechange formview databound label text













1















Hi I am having some trouble with my code. I have an ASP radiobuttonlist and want to display contents when there is a item selected. But when I select a radiobutton, and switch back to the old one my content doesn't show up any more.



This is my Asp code full page the javascript in here is commented out so it is not a part of working code.



Before I had ASP radiobuttons I had buttons did worked as pleased but I had to switch to ASP buttons for a reason.



<%@ Page Title="" Language="C#" MasterPageFile="~/Menu.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="DomoticaProject.Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<!--
<script type="text/javascript">
$(function ()
var radios = document.getElementsById("RadioButtonList1");
var Login = document.getElementById("lbllogin");
var Signin = document.getElementById("lblSignup");
var Reset = document.getElementById("lblReset");
Login.style.display = 'block'; // show
Signin.style.display = 'none'; // hide
Reset.style.display = 'none'; // hide
for(var i = 0; i < radios.Items.Count; i++)
radios[i].onclick = function()
var val = this.value;
if (val == 'signin')
Login.style.display = 'block';
Signin.style.display = 'none';
Reset.style.display = 'none';

else if (val == 'signup')
Login.style.display = 'none';
Signin.style.display = 'block';
Reset.style.display = 'none';

else if (val == 'reset')
Login.style.display = 'none';
Signin.style.display = 'none';
Reset.style.display = 'block';




);
</script>
-->

<style type="text/css">

.Loginform
text-align: center;
position: relative;
top: 30vh;


.inlog
display: block;
letter-spacing: 4px;
padding-top: 30px;
text-align: center;

.inlog .invoertext
display:block;
color: white;
cursor: text;
font-size: 20px;
line-height: 20px;
text-transform: uppercase;
-moz-transform: translateY(-34px);
-ms-transform: translateY(-34px);
-webkit-transform: translateY(-34px);
transform: translateY(-34px);
transition: all 0.3s;

.inlog .invoertype
background-color: transparent;
border: 0;
border-bottom: 2px solid white;
color: white;
font-size: 36px;
letter-spacing: -1px;
outline: 0;
padding: 5px 20px;
text-align: center;
transition: all 0.3s;
width: 200px;

.inlog .invoertype:focus
max-width: 100%;
width: 400px;

.inlog .invoertype:focus + .invoertext
color: whitesmoke;
font-size: 13px;
-moz-transform: translateY(-74px);
-ms-transform: translateY(-74px);
-webkit-transform: translateY(-74px);
transform: translateY(-74px);

.inlog .invoertype:valid + .invoertext
font-size: 13px;
-moz-transform: translateY(-74px);
-ms-transform: translateY(-74px);
-webkit-transform: translateY(-74px);
transform: translateY(-74px);






.Navigatieinlog
width: 450px;
height: 30px;
margin: -185px -225px;
position: absolute;
left: 50%;
top: 45vh;
display:block;


.alleinput[type=radio]display:none

.lblnavigatie
cursor: pointer;
display: inline-block;
letter-spacing: 4px;
padding-top: 30px;
text-align: center;


.lblnavigatie[for="signin"] margin-right: 20px;
.lblnavigatie[for="reset"] float: right;
.lblnavigatie[type=radio]:checked + .lblnavigatie opacity: 1;



.btn-draw
background-color: #333333;
border: 2px solid white;
border-radius: 27px;
color: white;
cursor: pointer;
font-size: 20px;
margin-top: 20px;
padding: 10px 20px;
text-transform: uppercase;
transition: all 200ms;

.btn-draw:hover, .btn-draw:focus
background-color: white;
color: #333333;
outline: 0;
transition:0.3s;

.buttonplacement
display: block;
letter-spacing: 4px;
text-align: center;



.Errormsg
display: block;
letter-spacing: 4px;
padding-top: 30px;
text-align: center;
font-size:14px;


</style>


<link rel = "stylesheet" href = "style.css">

<!-- Inlog -->

<form runat="server">

<div>
<asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList55" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
<asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
<asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
<asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
</asp:RadioButtonList>

<%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
</div>


<asp:UpdatePanel runat="server">
<ContentTemplate>

<asp:Label runat="server" id="lbllogin" visible="true">
<label id="Login" class="Loginform">

<label class="inlog">
<asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
<asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
</label>

<asp:RequiredFieldValidator
class="Errormsg"
runat="server"
ControlTovalidate="txtemailinlog"
ErrorMessage="Email is required"
ForeColor="Red"
ValidationGroup="Login"
Display="Dynamic">
</asp:RequiredFieldValidator>

<asp:RegularExpressionValidator
class="Errormsg"
runat="server"
ControlToValidate="txtemailinlog"
ErrorMessage="Voer geldig email adress in"
ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
ForeColor="Red"
ValidationGroup="Login"
Display="Dynamic">
</asp:RegularExpressionValidator>

<label class="inlog">
<asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
<asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
</label>

<asp:RequiredFieldValidator
class="Errormsg"
runat ="server"
ControlTovalidate ="txtpasswordlogin"
ErrorMessage ="Password is required"
ForeColor="Red"
ValidationGroup="Login"
Display="Dynamic">
</asp:RequiredFieldValidator>

<label class="buttonplacement">
<asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
</label>
</label>
</asp:Label>
<!-- Signup -->
<asp:Label runat="server" id="lblSignup" visible="false">
<label id="Naam" class="Loginform">
<label class="inlog">
<asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
<asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
</label>


</label>

<asp:RequiredFieldValidator
class="Errormsg"
runat="server"
ControlTovalidate="txtNaam"
ErrorMessage="Naam is required"
ForeColor="Red"
ValidationGroup="Sigin"
Display="Dynamic">
</asp:RequiredFieldValidator>

<asp:RegularExpressionValidator
class="Errormsg"
runat="server"
ControlToValidate="txtNaam"
ErrorMessage="Voer geldige voornaam in"
ValidationExpression="^[a-zA-Z]2,$"
ForeColor="Red"
ValidationGroup="Sigin"
Display="Dynamic">
</asp:RegularExpressionValidator>
</label>


<label id="Signin" class="Loginform">
<label class="inlog">
<asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
<asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
</label>

<asp:RequiredFieldValidator
class="Errormsg"
runat="server"
ControlTovalidate="txtemailsignin"
ErrorMessage="Email is required"
ForeColor="Red"
ValidationGroup="Sigin"
Display="Dynamic">
</asp:RequiredFieldValidator>

<asp:RegularExpressionValidator
class="Errormsg"
runat="server"
ControlToValidate="txtemailsignin"
ErrorMessage="Voer geldig email adress in"
ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
ForeColor="Red"
ValidationGroup="Sigin"
Display="Dynamic">
</asp:RegularExpressionValidator>

<asp:CustomValidator
id="Signinemailgebuik"
class="Errormsg"
runat="server"
ErrorMessage="Email is al in gebruik"
ForeColor="Red"
ValidationGroup="Sigin"
Display="Dynamic"
></asp:CustomValidator>


<label class="inlog">
<asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
<asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
</label>

<asp:RequiredFieldValidator
class="Errormsg"
runat="server"
ControlTovalidate="txtPasswordsignin"
ErrorMessage="Password is required"
ForeColor="Red"
ValidationGroup="Sigin"
Display="Dynamic">
</asp:RequiredFieldValidator>

<asp:RegularExpressionValidator
class="Errormsg"
runat="server"
ControlToValidate="txtPasswordsignin"
ErrorMessage="Password does not meet requirements"
ValidationExpression="^.*(?=.6,)((?=.*[!@#$%^&*()-_=+;:,<.>])1)(?=.*d)((?=.*[a-z])1)((?=.*[A-Z])1).*$"
ForeColor="Red"
ValidationGroup="Sigin"
Display="Dynamic">
</asp:RegularExpressionValidator>

<label class="inlog">
<asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
<asp:Label class="invoertext" runat="server" Text="Repeat password">
</asp:Label>

</label>

<asp:RequiredFieldValidator
class="Errormsg"
runat="server"
ControlTovalidate="txtpasswordsignrepeat"
ErrorMessage="Password is required"
ValidationGroup="Sigin"
Display="Dynamic"
ForeColor="Red">
</asp:RequiredFieldValidator>

<asp:CompareValidator
class="Errormsg"
runat="server"
ControlToValidate="txtpasswordsignrepeat"
ControlToCompare="txtPasswordsignin"
Type="String" Operator="Equal"
ErrorMessage="Password not the same"
ForeColor="Red"
ValidationGroup="Sigin"
Display="Dynamic">
</asp:CompareValidator>

</label>

<label class="buttonplacement">
<asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
</label>
</label>
</asp:Label>
<!-- Reset -->
<asp:Label runat="server" id="lblReset" visible="false">
<label id="Reset" class="Loginform">
<label class="inlog">
<asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
<asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
</label>

<asp:RequiredFieldValidator
class="Errormsg"
runat="server"
ControlTovalidate="txtemailreset"
ErrorMessage="Email is required"
ForeColor="Red"
ValidationGroup="Reset"
Display="Dynamic">
</asp:RequiredFieldValidator>

<asp:RegularExpressionValidator
class="Errormsg"
runat="server"
ControlToValidate="txtemailreset"
ErrorMessage="Voer geldig email adress in"
ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
ForeColor="Red"
ValidationGroup="Reset"
Display="Dynamic">
</asp:RegularExpressionValidator>

<label class="buttonplacement">
<asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
</label>
</label>
</asp:Label>

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<!--
<asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton1" GroupName="Radiobtn" Text="Sign in" runat="server" />
<asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton2" GroupName="Radiobtn" Text="Sign up" runat="server" />
<asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton3" GroupName="Radiobtn" Text="Reset" runat="server" />

<asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
<asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
<asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
<asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
</asp:RadioButtonList>
-->



</ContentTemplate>
</asp:UpdatePanel>
</form>

<!-- Navigatie -->

</asp:Content>


This is my behind code in C#



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Web.Security;

namespace DomoticaProject

public partial class Login : System.Web.UI.Page




protected void Page_Load(object sender, EventArgs e)




protected void Unnamed16_Click(object sender, EventArgs e)

if (Page.IsValid)

string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
SqlConnection con = new SqlConnection();
con.ConnectionString = CS;

try

SqlCommand cmd = new SqlCommand("RegisterUser", con);
cmd.CommandType = CommandType.StoredProcedure;

string EncryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPasswordsignin.Text, "SHA1");

SqlParameter Naam = new SqlParameter("@Naam", txtNaam.Text);

SqlParameter Email = new SqlParameter("@Email", txtemailsignin.Text);
SqlParameter Wachtwoord = new SqlParameter("@Wachtwoord", EncryptedPassword);

cmd.Parameters.Add(Naam);
cmd.Parameters.Add(Email);
cmd.Parameters.Add(Wachtwoord);


con.Open();
int ReturnCode = (int)cmd.ExecuteScalar();
if(ReturnCode == -1)

Signinemailgebuik.IsValid = false;


catch



finally

con.Close();




protected void SelectedButtonChange(object sender, EventArgs e)

if (RadioButtonList55.SelectedIndex > -1)

lbllogin.Visible = false;
lblSignup.Visible = false;
lblReset.Visible = false;
string selected = RadioButtonList55.SelectedItem.Text;
switch (selected)

case "Sign in":
lbllogin.Visible = true;
break;
case "Sign up":
lblSignup.Visible = true;
break;
case "Reset":
lblReset.Visible = true;
break;
















share|improve this question




























    1















    Hi I am having some trouble with my code. I have an ASP radiobuttonlist and want to display contents when there is a item selected. But when I select a radiobutton, and switch back to the old one my content doesn't show up any more.



    This is my Asp code full page the javascript in here is commented out so it is not a part of working code.



    Before I had ASP radiobuttons I had buttons did worked as pleased but I had to switch to ASP buttons for a reason.



    <%@ Page Title="" Language="C#" MasterPageFile="~/Menu.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="DomoticaProject.Login" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <!--
    <script type="text/javascript">
    $(function ()
    var radios = document.getElementsById("RadioButtonList1");
    var Login = document.getElementById("lbllogin");
    var Signin = document.getElementById("lblSignup");
    var Reset = document.getElementById("lblReset");
    Login.style.display = 'block'; // show
    Signin.style.display = 'none'; // hide
    Reset.style.display = 'none'; // hide
    for(var i = 0; i < radios.Items.Count; i++)
    radios[i].onclick = function()
    var val = this.value;
    if (val == 'signin')
    Login.style.display = 'block';
    Signin.style.display = 'none';
    Reset.style.display = 'none';

    else if (val == 'signup')
    Login.style.display = 'none';
    Signin.style.display = 'block';
    Reset.style.display = 'none';

    else if (val == 'reset')
    Login.style.display = 'none';
    Signin.style.display = 'none';
    Reset.style.display = 'block';




    );
    </script>
    -->

    <style type="text/css">

    .Loginform
    text-align: center;
    position: relative;
    top: 30vh;


    .inlog
    display: block;
    letter-spacing: 4px;
    padding-top: 30px;
    text-align: center;

    .inlog .invoertext
    display:block;
    color: white;
    cursor: text;
    font-size: 20px;
    line-height: 20px;
    text-transform: uppercase;
    -moz-transform: translateY(-34px);
    -ms-transform: translateY(-34px);
    -webkit-transform: translateY(-34px);
    transform: translateY(-34px);
    transition: all 0.3s;

    .inlog .invoertype
    background-color: transparent;
    border: 0;
    border-bottom: 2px solid white;
    color: white;
    font-size: 36px;
    letter-spacing: -1px;
    outline: 0;
    padding: 5px 20px;
    text-align: center;
    transition: all 0.3s;
    width: 200px;

    .inlog .invoertype:focus
    max-width: 100%;
    width: 400px;

    .inlog .invoertype:focus + .invoertext
    color: whitesmoke;
    font-size: 13px;
    -moz-transform: translateY(-74px);
    -ms-transform: translateY(-74px);
    -webkit-transform: translateY(-74px);
    transform: translateY(-74px);

    .inlog .invoertype:valid + .invoertext
    font-size: 13px;
    -moz-transform: translateY(-74px);
    -ms-transform: translateY(-74px);
    -webkit-transform: translateY(-74px);
    transform: translateY(-74px);






    .Navigatieinlog
    width: 450px;
    height: 30px;
    margin: -185px -225px;
    position: absolute;
    left: 50%;
    top: 45vh;
    display:block;


    .alleinput[type=radio]display:none

    .lblnavigatie
    cursor: pointer;
    display: inline-block;
    letter-spacing: 4px;
    padding-top: 30px;
    text-align: center;


    .lblnavigatie[for="signin"] margin-right: 20px;
    .lblnavigatie[for="reset"] float: right;
    .lblnavigatie[type=radio]:checked + .lblnavigatie opacity: 1;



    .btn-draw
    background-color: #333333;
    border: 2px solid white;
    border-radius: 27px;
    color: white;
    cursor: pointer;
    font-size: 20px;
    margin-top: 20px;
    padding: 10px 20px;
    text-transform: uppercase;
    transition: all 200ms;

    .btn-draw:hover, .btn-draw:focus
    background-color: white;
    color: #333333;
    outline: 0;
    transition:0.3s;

    .buttonplacement
    display: block;
    letter-spacing: 4px;
    text-align: center;



    .Errormsg
    display: block;
    letter-spacing: 4px;
    padding-top: 30px;
    text-align: center;
    font-size:14px;


    </style>


    <link rel = "stylesheet" href = "style.css">

    <!-- Inlog -->

    <form runat="server">

    <div>
    <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList55" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
    <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
    <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
    </asp:RadioButtonList>

    <%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
    </div>


    <asp:UpdatePanel runat="server">
    <ContentTemplate>

    <asp:Label runat="server" id="lbllogin" visible="true">
    <label id="Login" class="Loginform">

    <label class="inlog">
    <asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
    <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
    </label>

    <asp:RequiredFieldValidator
    class="Errormsg"
    runat="server"
    ControlTovalidate="txtemailinlog"
    ErrorMessage="Email is required"
    ForeColor="Red"
    ValidationGroup="Login"
    Display="Dynamic">
    </asp:RequiredFieldValidator>

    <asp:RegularExpressionValidator
    class="Errormsg"
    runat="server"
    ControlToValidate="txtemailinlog"
    ErrorMessage="Voer geldig email adress in"
    ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
    ForeColor="Red"
    ValidationGroup="Login"
    Display="Dynamic">
    </asp:RegularExpressionValidator>

    <label class="inlog">
    <asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
    <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
    </label>

    <asp:RequiredFieldValidator
    class="Errormsg"
    runat ="server"
    ControlTovalidate ="txtpasswordlogin"
    ErrorMessage ="Password is required"
    ForeColor="Red"
    ValidationGroup="Login"
    Display="Dynamic">
    </asp:RequiredFieldValidator>

    <label class="buttonplacement">
    <asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
    </label>
    </label>
    </asp:Label>
    <!-- Signup -->
    <asp:Label runat="server" id="lblSignup" visible="false">
    <label id="Naam" class="Loginform">
    <label class="inlog">
    <asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
    <asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
    </label>


    </label>

    <asp:RequiredFieldValidator
    class="Errormsg"
    runat="server"
    ControlTovalidate="txtNaam"
    ErrorMessage="Naam is required"
    ForeColor="Red"
    ValidationGroup="Sigin"
    Display="Dynamic">
    </asp:RequiredFieldValidator>

    <asp:RegularExpressionValidator
    class="Errormsg"
    runat="server"
    ControlToValidate="txtNaam"
    ErrorMessage="Voer geldige voornaam in"
    ValidationExpression="^[a-zA-Z]2,$"
    ForeColor="Red"
    ValidationGroup="Sigin"
    Display="Dynamic">
    </asp:RegularExpressionValidator>
    </label>


    <label id="Signin" class="Loginform">
    <label class="inlog">
    <asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
    <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
    </label>

    <asp:RequiredFieldValidator
    class="Errormsg"
    runat="server"
    ControlTovalidate="txtemailsignin"
    ErrorMessage="Email is required"
    ForeColor="Red"
    ValidationGroup="Sigin"
    Display="Dynamic">
    </asp:RequiredFieldValidator>

    <asp:RegularExpressionValidator
    class="Errormsg"
    runat="server"
    ControlToValidate="txtemailsignin"
    ErrorMessage="Voer geldig email adress in"
    ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
    ForeColor="Red"
    ValidationGroup="Sigin"
    Display="Dynamic">
    </asp:RegularExpressionValidator>

    <asp:CustomValidator
    id="Signinemailgebuik"
    class="Errormsg"
    runat="server"
    ErrorMessage="Email is al in gebruik"
    ForeColor="Red"
    ValidationGroup="Sigin"
    Display="Dynamic"
    ></asp:CustomValidator>


    <label class="inlog">
    <asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
    <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
    </label>

    <asp:RequiredFieldValidator
    class="Errormsg"
    runat="server"
    ControlTovalidate="txtPasswordsignin"
    ErrorMessage="Password is required"
    ForeColor="Red"
    ValidationGroup="Sigin"
    Display="Dynamic">
    </asp:RequiredFieldValidator>

    <asp:RegularExpressionValidator
    class="Errormsg"
    runat="server"
    ControlToValidate="txtPasswordsignin"
    ErrorMessage="Password does not meet requirements"
    ValidationExpression="^.*(?=.6,)((?=.*[!@#$%^&*()-_=+;:,<.>])1)(?=.*d)((?=.*[a-z])1)((?=.*[A-Z])1).*$"
    ForeColor="Red"
    ValidationGroup="Sigin"
    Display="Dynamic">
    </asp:RegularExpressionValidator>

    <label class="inlog">
    <asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
    <asp:Label class="invoertext" runat="server" Text="Repeat password">
    </asp:Label>

    </label>

    <asp:RequiredFieldValidator
    class="Errormsg"
    runat="server"
    ControlTovalidate="txtpasswordsignrepeat"
    ErrorMessage="Password is required"
    ValidationGroup="Sigin"
    Display="Dynamic"
    ForeColor="Red">
    </asp:RequiredFieldValidator>

    <asp:CompareValidator
    class="Errormsg"
    runat="server"
    ControlToValidate="txtpasswordsignrepeat"
    ControlToCompare="txtPasswordsignin"
    Type="String" Operator="Equal"
    ErrorMessage="Password not the same"
    ForeColor="Red"
    ValidationGroup="Sigin"
    Display="Dynamic">
    </asp:CompareValidator>

    </label>

    <label class="buttonplacement">
    <asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
    </label>
    </label>
    </asp:Label>
    <!-- Reset -->
    <asp:Label runat="server" id="lblReset" visible="false">
    <label id="Reset" class="Loginform">
    <label class="inlog">
    <asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
    <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
    </label>

    <asp:RequiredFieldValidator
    class="Errormsg"
    runat="server"
    ControlTovalidate="txtemailreset"
    ErrorMessage="Email is required"
    ForeColor="Red"
    ValidationGroup="Reset"
    Display="Dynamic">
    </asp:RequiredFieldValidator>

    <asp:RegularExpressionValidator
    class="Errormsg"
    runat="server"
    ControlToValidate="txtemailreset"
    ErrorMessage="Voer geldig email adress in"
    ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
    ForeColor="Red"
    ValidationGroup="Reset"
    Display="Dynamic">
    </asp:RegularExpressionValidator>

    <label class="buttonplacement">
    <asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
    </label>
    </label>
    </asp:Label>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <!--
    <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton1" GroupName="Radiobtn" Text="Sign in" runat="server" />
    <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton2" GroupName="Radiobtn" Text="Sign up" runat="server" />
    <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton3" GroupName="Radiobtn" Text="Reset" runat="server" />

    <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
    <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
    <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
    </asp:RadioButtonList>
    -->



    </ContentTemplate>
    </asp:UpdatePanel>
    </form>

    <!-- Navigatie -->

    </asp:Content>


    This is my behind code in C#



    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data.SqlClient;
    using System.Data;
    using System.Configuration;
    using System.Web.Security;

    namespace DomoticaProject

    public partial class Login : System.Web.UI.Page




    protected void Page_Load(object sender, EventArgs e)




    protected void Unnamed16_Click(object sender, EventArgs e)

    if (Page.IsValid)

    string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
    SqlConnection con = new SqlConnection();
    con.ConnectionString = CS;

    try

    SqlCommand cmd = new SqlCommand("RegisterUser", con);
    cmd.CommandType = CommandType.StoredProcedure;

    string EncryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPasswordsignin.Text, "SHA1");

    SqlParameter Naam = new SqlParameter("@Naam", txtNaam.Text);

    SqlParameter Email = new SqlParameter("@Email", txtemailsignin.Text);
    SqlParameter Wachtwoord = new SqlParameter("@Wachtwoord", EncryptedPassword);

    cmd.Parameters.Add(Naam);
    cmd.Parameters.Add(Email);
    cmd.Parameters.Add(Wachtwoord);


    con.Open();
    int ReturnCode = (int)cmd.ExecuteScalar();
    if(ReturnCode == -1)

    Signinemailgebuik.IsValid = false;


    catch



    finally

    con.Close();




    protected void SelectedButtonChange(object sender, EventArgs e)

    if (RadioButtonList55.SelectedIndex > -1)

    lbllogin.Visible = false;
    lblSignup.Visible = false;
    lblReset.Visible = false;
    string selected = RadioButtonList55.SelectedItem.Text;
    switch (selected)

    case "Sign in":
    lbllogin.Visible = true;
    break;
    case "Sign up":
    lblSignup.Visible = true;
    break;
    case "Reset":
    lblReset.Visible = true;
    break;
















    share|improve this question


























      1












      1








      1








      Hi I am having some trouble with my code. I have an ASP radiobuttonlist and want to display contents when there is a item selected. But when I select a radiobutton, and switch back to the old one my content doesn't show up any more.



      This is my Asp code full page the javascript in here is commented out so it is not a part of working code.



      Before I had ASP radiobuttons I had buttons did worked as pleased but I had to switch to ASP buttons for a reason.



      <%@ Page Title="" Language="C#" MasterPageFile="~/Menu.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="DomoticaProject.Login" %>
      <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
      <script src="http://code.jquery.com/jquery-latest.min.js"></script>
      </asp:Content>
      <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

      <!--
      <script type="text/javascript">
      $(function ()
      var radios = document.getElementsById("RadioButtonList1");
      var Login = document.getElementById("lbllogin");
      var Signin = document.getElementById("lblSignup");
      var Reset = document.getElementById("lblReset");
      Login.style.display = 'block'; // show
      Signin.style.display = 'none'; // hide
      Reset.style.display = 'none'; // hide
      for(var i = 0; i < radios.Items.Count; i++)
      radios[i].onclick = function()
      var val = this.value;
      if (val == 'signin')
      Login.style.display = 'block';
      Signin.style.display = 'none';
      Reset.style.display = 'none';

      else if (val == 'signup')
      Login.style.display = 'none';
      Signin.style.display = 'block';
      Reset.style.display = 'none';

      else if (val == 'reset')
      Login.style.display = 'none';
      Signin.style.display = 'none';
      Reset.style.display = 'block';




      );
      </script>
      -->

      <style type="text/css">

      .Loginform
      text-align: center;
      position: relative;
      top: 30vh;


      .inlog
      display: block;
      letter-spacing: 4px;
      padding-top: 30px;
      text-align: center;

      .inlog .invoertext
      display:block;
      color: white;
      cursor: text;
      font-size: 20px;
      line-height: 20px;
      text-transform: uppercase;
      -moz-transform: translateY(-34px);
      -ms-transform: translateY(-34px);
      -webkit-transform: translateY(-34px);
      transform: translateY(-34px);
      transition: all 0.3s;

      .inlog .invoertype
      background-color: transparent;
      border: 0;
      border-bottom: 2px solid white;
      color: white;
      font-size: 36px;
      letter-spacing: -1px;
      outline: 0;
      padding: 5px 20px;
      text-align: center;
      transition: all 0.3s;
      width: 200px;

      .inlog .invoertype:focus
      max-width: 100%;
      width: 400px;

      .inlog .invoertype:focus + .invoertext
      color: whitesmoke;
      font-size: 13px;
      -moz-transform: translateY(-74px);
      -ms-transform: translateY(-74px);
      -webkit-transform: translateY(-74px);
      transform: translateY(-74px);

      .inlog .invoertype:valid + .invoertext
      font-size: 13px;
      -moz-transform: translateY(-74px);
      -ms-transform: translateY(-74px);
      -webkit-transform: translateY(-74px);
      transform: translateY(-74px);






      .Navigatieinlog
      width: 450px;
      height: 30px;
      margin: -185px -225px;
      position: absolute;
      left: 50%;
      top: 45vh;
      display:block;


      .alleinput[type=radio]display:none

      .lblnavigatie
      cursor: pointer;
      display: inline-block;
      letter-spacing: 4px;
      padding-top: 30px;
      text-align: center;


      .lblnavigatie[for="signin"] margin-right: 20px;
      .lblnavigatie[for="reset"] float: right;
      .lblnavigatie[type=radio]:checked + .lblnavigatie opacity: 1;



      .btn-draw
      background-color: #333333;
      border: 2px solid white;
      border-radius: 27px;
      color: white;
      cursor: pointer;
      font-size: 20px;
      margin-top: 20px;
      padding: 10px 20px;
      text-transform: uppercase;
      transition: all 200ms;

      .btn-draw:hover, .btn-draw:focus
      background-color: white;
      color: #333333;
      outline: 0;
      transition:0.3s;

      .buttonplacement
      display: block;
      letter-spacing: 4px;
      text-align: center;



      .Errormsg
      display: block;
      letter-spacing: 4px;
      padding-top: 30px;
      text-align: center;
      font-size:14px;


      </style>


      <link rel = "stylesheet" href = "style.css">

      <!-- Inlog -->

      <form runat="server">

      <div>
      <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList55" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
      <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
      <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
      <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
      </asp:RadioButtonList>

      <%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
      </div>


      <asp:UpdatePanel runat="server">
      <ContentTemplate>

      <asp:Label runat="server" id="lbllogin" visible="true">
      <label id="Login" class="Loginform">

      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtemailinlog"
      ErrorMessage="Email is required"
      ForeColor="Red"
      ValidationGroup="Login"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtemailinlog"
      ErrorMessage="Voer geldig email adress in"
      ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
      ForeColor="Red"
      ValidationGroup="Login"
      Display="Dynamic">
      </asp:RegularExpressionValidator>

      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat ="server"
      ControlTovalidate ="txtpasswordlogin"
      ErrorMessage ="Password is required"
      ForeColor="Red"
      ValidationGroup="Login"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <label class="buttonplacement">
      <asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
      </label>
      </label>
      </asp:Label>
      <!-- Signup -->
      <asp:Label runat="server" id="lblSignup" visible="false">
      <label id="Naam" class="Loginform">
      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
      </label>


      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtNaam"
      ErrorMessage="Naam is required"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtNaam"
      ErrorMessage="Voer geldige voornaam in"
      ValidationExpression="^[a-zA-Z]2,$"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RegularExpressionValidator>
      </label>


      <label id="Signin" class="Loginform">
      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtemailsignin"
      ErrorMessage="Email is required"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtemailsignin"
      ErrorMessage="Voer geldig email adress in"
      ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RegularExpressionValidator>

      <asp:CustomValidator
      id="Signinemailgebuik"
      class="Errormsg"
      runat="server"
      ErrorMessage="Email is al in gebruik"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic"
      ></asp:CustomValidator>


      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtPasswordsignin"
      ErrorMessage="Password is required"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtPasswordsignin"
      ErrorMessage="Password does not meet requirements"
      ValidationExpression="^.*(?=.6,)((?=.*[!@#$%^&*()-_=+;:,<.>])1)(?=.*d)((?=.*[a-z])1)((?=.*[A-Z])1).*$"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RegularExpressionValidator>

      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Repeat password">
      </asp:Label>

      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtpasswordsignrepeat"
      ErrorMessage="Password is required"
      ValidationGroup="Sigin"
      Display="Dynamic"
      ForeColor="Red">
      </asp:RequiredFieldValidator>

      <asp:CompareValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtpasswordsignrepeat"
      ControlToCompare="txtPasswordsignin"
      Type="String" Operator="Equal"
      ErrorMessage="Password not the same"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:CompareValidator>

      </label>

      <label class="buttonplacement">
      <asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
      </label>
      </label>
      </asp:Label>
      <!-- Reset -->
      <asp:Label runat="server" id="lblReset" visible="false">
      <label id="Reset" class="Loginform">
      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtemailreset"
      ErrorMessage="Email is required"
      ForeColor="Red"
      ValidationGroup="Reset"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtemailreset"
      ErrorMessage="Voer geldig email adress in"
      ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
      ForeColor="Red"
      ValidationGroup="Reset"
      Display="Dynamic">
      </asp:RegularExpressionValidator>

      <label class="buttonplacement">
      <asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
      </label>
      </label>
      </asp:Label>

      <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager>
      <!--
      <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton1" GroupName="Radiobtn" Text="Sign in" runat="server" />
      <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton2" GroupName="Radiobtn" Text="Sign up" runat="server" />
      <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton3" GroupName="Radiobtn" Text="Reset" runat="server" />

      <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
      <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
      <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
      <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
      </asp:RadioButtonList>
      -->



      </ContentTemplate>
      </asp:UpdatePanel>
      </form>

      <!-- Navigatie -->

      </asp:Content>


      This is my behind code in C#



      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Web;
      using System.Web.UI;
      using System.Web.UI.WebControls;
      using System.Data.SqlClient;
      using System.Data;
      using System.Configuration;
      using System.Web.Security;

      namespace DomoticaProject

      public partial class Login : System.Web.UI.Page




      protected void Page_Load(object sender, EventArgs e)




      protected void Unnamed16_Click(object sender, EventArgs e)

      if (Page.IsValid)

      string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
      SqlConnection con = new SqlConnection();
      con.ConnectionString = CS;

      try

      SqlCommand cmd = new SqlCommand("RegisterUser", con);
      cmd.CommandType = CommandType.StoredProcedure;

      string EncryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPasswordsignin.Text, "SHA1");

      SqlParameter Naam = new SqlParameter("@Naam", txtNaam.Text);

      SqlParameter Email = new SqlParameter("@Email", txtemailsignin.Text);
      SqlParameter Wachtwoord = new SqlParameter("@Wachtwoord", EncryptedPassword);

      cmd.Parameters.Add(Naam);
      cmd.Parameters.Add(Email);
      cmd.Parameters.Add(Wachtwoord);


      con.Open();
      int ReturnCode = (int)cmd.ExecuteScalar();
      if(ReturnCode == -1)

      Signinemailgebuik.IsValid = false;


      catch



      finally

      con.Close();




      protected void SelectedButtonChange(object sender, EventArgs e)

      if (RadioButtonList55.SelectedIndex > -1)

      lbllogin.Visible = false;
      lblSignup.Visible = false;
      lblReset.Visible = false;
      string selected = RadioButtonList55.SelectedItem.Text;
      switch (selected)

      case "Sign in":
      lbllogin.Visible = true;
      break;
      case "Sign up":
      lblSignup.Visible = true;
      break;
      case "Reset":
      lblReset.Visible = true;
      break;
















      share|improve this question
















      Hi I am having some trouble with my code. I have an ASP radiobuttonlist and want to display contents when there is a item selected. But when I select a radiobutton, and switch back to the old one my content doesn't show up any more.



      This is my Asp code full page the javascript in here is commented out so it is not a part of working code.



      Before I had ASP radiobuttons I had buttons did worked as pleased but I had to switch to ASP buttons for a reason.



      <%@ Page Title="" Language="C#" MasterPageFile="~/Menu.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="DomoticaProject.Login" %>
      <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
      <script src="http://code.jquery.com/jquery-latest.min.js"></script>
      </asp:Content>
      <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

      <!--
      <script type="text/javascript">
      $(function ()
      var radios = document.getElementsById("RadioButtonList1");
      var Login = document.getElementById("lbllogin");
      var Signin = document.getElementById("lblSignup");
      var Reset = document.getElementById("lblReset");
      Login.style.display = 'block'; // show
      Signin.style.display = 'none'; // hide
      Reset.style.display = 'none'; // hide
      for(var i = 0; i < radios.Items.Count; i++)
      radios[i].onclick = function()
      var val = this.value;
      if (val == 'signin')
      Login.style.display = 'block';
      Signin.style.display = 'none';
      Reset.style.display = 'none';

      else if (val == 'signup')
      Login.style.display = 'none';
      Signin.style.display = 'block';
      Reset.style.display = 'none';

      else if (val == 'reset')
      Login.style.display = 'none';
      Signin.style.display = 'none';
      Reset.style.display = 'block';




      );
      </script>
      -->

      <style type="text/css">

      .Loginform
      text-align: center;
      position: relative;
      top: 30vh;


      .inlog
      display: block;
      letter-spacing: 4px;
      padding-top: 30px;
      text-align: center;

      .inlog .invoertext
      display:block;
      color: white;
      cursor: text;
      font-size: 20px;
      line-height: 20px;
      text-transform: uppercase;
      -moz-transform: translateY(-34px);
      -ms-transform: translateY(-34px);
      -webkit-transform: translateY(-34px);
      transform: translateY(-34px);
      transition: all 0.3s;

      .inlog .invoertype
      background-color: transparent;
      border: 0;
      border-bottom: 2px solid white;
      color: white;
      font-size: 36px;
      letter-spacing: -1px;
      outline: 0;
      padding: 5px 20px;
      text-align: center;
      transition: all 0.3s;
      width: 200px;

      .inlog .invoertype:focus
      max-width: 100%;
      width: 400px;

      .inlog .invoertype:focus + .invoertext
      color: whitesmoke;
      font-size: 13px;
      -moz-transform: translateY(-74px);
      -ms-transform: translateY(-74px);
      -webkit-transform: translateY(-74px);
      transform: translateY(-74px);

      .inlog .invoertype:valid + .invoertext
      font-size: 13px;
      -moz-transform: translateY(-74px);
      -ms-transform: translateY(-74px);
      -webkit-transform: translateY(-74px);
      transform: translateY(-74px);






      .Navigatieinlog
      width: 450px;
      height: 30px;
      margin: -185px -225px;
      position: absolute;
      left: 50%;
      top: 45vh;
      display:block;


      .alleinput[type=radio]display:none

      .lblnavigatie
      cursor: pointer;
      display: inline-block;
      letter-spacing: 4px;
      padding-top: 30px;
      text-align: center;


      .lblnavigatie[for="signin"] margin-right: 20px;
      .lblnavigatie[for="reset"] float: right;
      .lblnavigatie[type=radio]:checked + .lblnavigatie opacity: 1;



      .btn-draw
      background-color: #333333;
      border: 2px solid white;
      border-radius: 27px;
      color: white;
      cursor: pointer;
      font-size: 20px;
      margin-top: 20px;
      padding: 10px 20px;
      text-transform: uppercase;
      transition: all 200ms;

      .btn-draw:hover, .btn-draw:focus
      background-color: white;
      color: #333333;
      outline: 0;
      transition:0.3s;

      .buttonplacement
      display: block;
      letter-spacing: 4px;
      text-align: center;



      .Errormsg
      display: block;
      letter-spacing: 4px;
      padding-top: 30px;
      text-align: center;
      font-size:14px;


      </style>


      <link rel = "stylesheet" href = "style.css">

      <!-- Inlog -->

      <form runat="server">

      <div>
      <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList55" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
      <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
      <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
      <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
      </asp:RadioButtonList>

      <%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
      </div>


      <asp:UpdatePanel runat="server">
      <ContentTemplate>

      <asp:Label runat="server" id="lbllogin" visible="true">
      <label id="Login" class="Loginform">

      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtemailinlog"
      ErrorMessage="Email is required"
      ForeColor="Red"
      ValidationGroup="Login"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtemailinlog"
      ErrorMessage="Voer geldig email adress in"
      ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
      ForeColor="Red"
      ValidationGroup="Login"
      Display="Dynamic">
      </asp:RegularExpressionValidator>

      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat ="server"
      ControlTovalidate ="txtpasswordlogin"
      ErrorMessage ="Password is required"
      ForeColor="Red"
      ValidationGroup="Login"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <label class="buttonplacement">
      <asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
      </label>
      </label>
      </asp:Label>
      <!-- Signup -->
      <asp:Label runat="server" id="lblSignup" visible="false">
      <label id="Naam" class="Loginform">
      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
      </label>


      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtNaam"
      ErrorMessage="Naam is required"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtNaam"
      ErrorMessage="Voer geldige voornaam in"
      ValidationExpression="^[a-zA-Z]2,$"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RegularExpressionValidator>
      </label>


      <label id="Signin" class="Loginform">
      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtemailsignin"
      ErrorMessage="Email is required"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtemailsignin"
      ErrorMessage="Voer geldig email adress in"
      ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RegularExpressionValidator>

      <asp:CustomValidator
      id="Signinemailgebuik"
      class="Errormsg"
      runat="server"
      ErrorMessage="Email is al in gebruik"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic"
      ></asp:CustomValidator>


      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtPasswordsignin"
      ErrorMessage="Password is required"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtPasswordsignin"
      ErrorMessage="Password does not meet requirements"
      ValidationExpression="^.*(?=.6,)((?=.*[!@#$%^&*()-_=+;:,<.>])1)(?=.*d)((?=.*[a-z])1)((?=.*[A-Z])1).*$"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:RegularExpressionValidator>

      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Repeat password">
      </asp:Label>

      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtpasswordsignrepeat"
      ErrorMessage="Password is required"
      ValidationGroup="Sigin"
      Display="Dynamic"
      ForeColor="Red">
      </asp:RequiredFieldValidator>

      <asp:CompareValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtpasswordsignrepeat"
      ControlToCompare="txtPasswordsignin"
      Type="String" Operator="Equal"
      ErrorMessage="Password not the same"
      ForeColor="Red"
      ValidationGroup="Sigin"
      Display="Dynamic">
      </asp:CompareValidator>

      </label>

      <label class="buttonplacement">
      <asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
      </label>
      </label>
      </asp:Label>
      <!-- Reset -->
      <asp:Label runat="server" id="lblReset" visible="false">
      <label id="Reset" class="Loginform">
      <label class="inlog">
      <asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
      <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
      </label>

      <asp:RequiredFieldValidator
      class="Errormsg"
      runat="server"
      ControlTovalidate="txtemailreset"
      ErrorMessage="Email is required"
      ForeColor="Red"
      ValidationGroup="Reset"
      Display="Dynamic">
      </asp:RequiredFieldValidator>

      <asp:RegularExpressionValidator
      class="Errormsg"
      runat="server"
      ControlToValidate="txtemailreset"
      ErrorMessage="Voer geldig email adress in"
      ValidationExpression="^w+([.-]?w+)*@w+([.-]?w+)*(.w2,6)+$"
      ForeColor="Red"
      ValidationGroup="Reset"
      Display="Dynamic">
      </asp:RegularExpressionValidator>

      <label class="buttonplacement">
      <asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
      </label>
      </label>
      </asp:Label>

      <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager>
      <!--
      <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton1" GroupName="Radiobtn" Text="Sign in" runat="server" />
      <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton2" GroupName="Radiobtn" Text="Sign up" runat="server" />
      <asp:RadioButton OnCheckedChanged="SelectedButtonChange" AutoPostBack="true" CssClass="Navigatieinlog" ID="RadioButton3" GroupName="Radiobtn" Text="Reset" runat="server" />

      <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
      <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
      <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
      <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
      </asp:RadioButtonList>
      -->



      </ContentTemplate>
      </asp:UpdatePanel>
      </form>

      <!-- Navigatie -->

      </asp:Content>


      This is my behind code in C#



      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Web;
      using System.Web.UI;
      using System.Web.UI.WebControls;
      using System.Data.SqlClient;
      using System.Data;
      using System.Configuration;
      using System.Web.Security;

      namespace DomoticaProject

      public partial class Login : System.Web.UI.Page




      protected void Page_Load(object sender, EventArgs e)




      protected void Unnamed16_Click(object sender, EventArgs e)

      if (Page.IsValid)

      string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
      SqlConnection con = new SqlConnection();
      con.ConnectionString = CS;

      try

      SqlCommand cmd = new SqlCommand("RegisterUser", con);
      cmd.CommandType = CommandType.StoredProcedure;

      string EncryptedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPasswordsignin.Text, "SHA1");

      SqlParameter Naam = new SqlParameter("@Naam", txtNaam.Text);

      SqlParameter Email = new SqlParameter("@Email", txtemailsignin.Text);
      SqlParameter Wachtwoord = new SqlParameter("@Wachtwoord", EncryptedPassword);

      cmd.Parameters.Add(Naam);
      cmd.Parameters.Add(Email);
      cmd.Parameters.Add(Wachtwoord);


      con.Open();
      int ReturnCode = (int)cmd.ExecuteScalar();
      if(ReturnCode == -1)

      Signinemailgebuik.IsValid = false;


      catch



      finally

      con.Close();




      protected void SelectedButtonChange(object sender, EventArgs e)

      if (RadioButtonList55.SelectedIndex > -1)

      lbllogin.Visible = false;
      lblSignup.Visible = false;
      lblReset.Visible = false;
      string selected = RadioButtonList55.SelectedItem.Text;
      switch (selected)

      case "Sign in":
      lbllogin.Visible = true;
      break;
      case "Sign up":
      lblSignup.Visible = true;
      break;
      case "Reset":
      lblReset.Visible = true;
      break;













      c# asp.net radiobuttonlist






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 12:14







      Bart franken

















      asked Mar 7 at 7:35









      Bart frankenBart franken

      165




      165






















          2 Answers
          2






          active

          oldest

          votes


















          0














          I think what you need to do is always set each Panel to it's default state before you do the foreach loop. Because ViewState will remember the Visible property of each Panel.



          lbllogin.Visible = true;
          lblSignup.Visible = true;
          lblReset.Visible = true;

          if (RadioButtonList1.SelectedValue == "signin")



          else if (RadioButtonList1.SelectedValue == "signup")








          share|improve this answer

























          • Sadly enough that did not do the job still same problem

            – Bart franken
            Mar 7 at 7:48











          • Updated my answer.

            – VDWWD
            Mar 7 at 7:50











          • Nope still didn't work altough I did had the same results instead of foreach

            – Bart franken
            Mar 7 at 7:55


















          0














          Please try with this example



          protected void SelectedButtonChange(object sender, EventArgs e)

          if (RadioButtonList1.SelectedIndex > -1)

          lbllogin.Visible = false;
          lblSignup.Visible = false;
          lblReset.Visible = false;
          string selected = RadioButtonList5.SelectedItem.Value;
          switch (selected)

          case "signin":
          lbllogin.Visible = true;
          break;
          case "signup":
          lblSignup.Visible = true;
          break;
          case "reset":
          lblReset.Visible = true;
          break;







          and change your List with this in aspx code



           <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>


          Update
          I have change my code to this.. it is working from mine side, just check. and adjust validation etc message from yours.



          <form id="form1" runat="server">
          <div>
          <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>

          <%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
          </div>

          <asp:Label runat="server" id="lbllogin" visible="true">
          <label id="Login" class="Loginform">

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
          </label>
          </label>
          </asp:Label>
          <!-- Signup -->
          <asp:Label runat="server" id="lblSignup" visible="false">
          <label id="Naam" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
          </label>


          </label>


          <label id="Signin" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Repeat password">
          </asp:Label>

          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
          </label>
          </label>
          </asp:Label>
          <!-- Reset -->
          <asp:Label runat="server" id="lblReset" visible="false">
          <label id="Reset" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
          </label>
          </label>
          </asp:Label>

          </form>





          share|improve this answer

























          • Comments are not for extended discussion; this conversation has been moved to chat.

            – Samuel Liew
            Mar 7 at 22:42










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038377%2fhow-to-loop-trough-radiobuttonlist-and-if-selected-show-content%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I think what you need to do is always set each Panel to it's default state before you do the foreach loop. Because ViewState will remember the Visible property of each Panel.



          lbllogin.Visible = true;
          lblSignup.Visible = true;
          lblReset.Visible = true;

          if (RadioButtonList1.SelectedValue == "signin")



          else if (RadioButtonList1.SelectedValue == "signup")








          share|improve this answer

























          • Sadly enough that did not do the job still same problem

            – Bart franken
            Mar 7 at 7:48











          • Updated my answer.

            – VDWWD
            Mar 7 at 7:50











          • Nope still didn't work altough I did had the same results instead of foreach

            – Bart franken
            Mar 7 at 7:55















          0














          I think what you need to do is always set each Panel to it's default state before you do the foreach loop. Because ViewState will remember the Visible property of each Panel.



          lbllogin.Visible = true;
          lblSignup.Visible = true;
          lblReset.Visible = true;

          if (RadioButtonList1.SelectedValue == "signin")



          else if (RadioButtonList1.SelectedValue == "signup")








          share|improve this answer

























          • Sadly enough that did not do the job still same problem

            – Bart franken
            Mar 7 at 7:48











          • Updated my answer.

            – VDWWD
            Mar 7 at 7:50











          • Nope still didn't work altough I did had the same results instead of foreach

            – Bart franken
            Mar 7 at 7:55













          0












          0








          0







          I think what you need to do is always set each Panel to it's default state before you do the foreach loop. Because ViewState will remember the Visible property of each Panel.



          lbllogin.Visible = true;
          lblSignup.Visible = true;
          lblReset.Visible = true;

          if (RadioButtonList1.SelectedValue == "signin")



          else if (RadioButtonList1.SelectedValue == "signup")








          share|improve this answer















          I think what you need to do is always set each Panel to it's default state before you do the foreach loop. Because ViewState will remember the Visible property of each Panel.



          lbllogin.Visible = true;
          lblSignup.Visible = true;
          lblReset.Visible = true;

          if (RadioButtonList1.SelectedValue == "signin")



          else if (RadioButtonList1.SelectedValue == "signup")









          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 7 at 7:50

























          answered Mar 7 at 7:45









          VDWWDVDWWD

          24.6k123856




          24.6k123856












          • Sadly enough that did not do the job still same problem

            – Bart franken
            Mar 7 at 7:48











          • Updated my answer.

            – VDWWD
            Mar 7 at 7:50











          • Nope still didn't work altough I did had the same results instead of foreach

            – Bart franken
            Mar 7 at 7:55

















          • Sadly enough that did not do the job still same problem

            – Bart franken
            Mar 7 at 7:48











          • Updated my answer.

            – VDWWD
            Mar 7 at 7:50











          • Nope still didn't work altough I did had the same results instead of foreach

            – Bart franken
            Mar 7 at 7:55
















          Sadly enough that did not do the job still same problem

          – Bart franken
          Mar 7 at 7:48





          Sadly enough that did not do the job still same problem

          – Bart franken
          Mar 7 at 7:48













          Updated my answer.

          – VDWWD
          Mar 7 at 7:50





          Updated my answer.

          – VDWWD
          Mar 7 at 7:50













          Nope still didn't work altough I did had the same results instead of foreach

          – Bart franken
          Mar 7 at 7:55





          Nope still didn't work altough I did had the same results instead of foreach

          – Bart franken
          Mar 7 at 7:55













          0














          Please try with this example



          protected void SelectedButtonChange(object sender, EventArgs e)

          if (RadioButtonList1.SelectedIndex > -1)

          lbllogin.Visible = false;
          lblSignup.Visible = false;
          lblReset.Visible = false;
          string selected = RadioButtonList5.SelectedItem.Value;
          switch (selected)

          case "signin":
          lbllogin.Visible = true;
          break;
          case "signup":
          lblSignup.Visible = true;
          break;
          case "reset":
          lblReset.Visible = true;
          break;







          and change your List with this in aspx code



           <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>


          Update
          I have change my code to this.. it is working from mine side, just check. and adjust validation etc message from yours.



          <form id="form1" runat="server">
          <div>
          <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>

          <%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
          </div>

          <asp:Label runat="server" id="lbllogin" visible="true">
          <label id="Login" class="Loginform">

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
          </label>
          </label>
          </asp:Label>
          <!-- Signup -->
          <asp:Label runat="server" id="lblSignup" visible="false">
          <label id="Naam" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
          </label>


          </label>


          <label id="Signin" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Repeat password">
          </asp:Label>

          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
          </label>
          </label>
          </asp:Label>
          <!-- Reset -->
          <asp:Label runat="server" id="lblReset" visible="false">
          <label id="Reset" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
          </label>
          </label>
          </asp:Label>

          </form>





          share|improve this answer

























          • Comments are not for extended discussion; this conversation has been moved to chat.

            – Samuel Liew
            Mar 7 at 22:42















          0














          Please try with this example



          protected void SelectedButtonChange(object sender, EventArgs e)

          if (RadioButtonList1.SelectedIndex > -1)

          lbllogin.Visible = false;
          lblSignup.Visible = false;
          lblReset.Visible = false;
          string selected = RadioButtonList5.SelectedItem.Value;
          switch (selected)

          case "signin":
          lbllogin.Visible = true;
          break;
          case "signup":
          lblSignup.Visible = true;
          break;
          case "reset":
          lblReset.Visible = true;
          break;







          and change your List with this in aspx code



           <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>


          Update
          I have change my code to this.. it is working from mine side, just check. and adjust validation etc message from yours.



          <form id="form1" runat="server">
          <div>
          <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>

          <%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
          </div>

          <asp:Label runat="server" id="lbllogin" visible="true">
          <label id="Login" class="Loginform">

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
          </label>
          </label>
          </asp:Label>
          <!-- Signup -->
          <asp:Label runat="server" id="lblSignup" visible="false">
          <label id="Naam" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
          </label>


          </label>


          <label id="Signin" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Repeat password">
          </asp:Label>

          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
          </label>
          </label>
          </asp:Label>
          <!-- Reset -->
          <asp:Label runat="server" id="lblReset" visible="false">
          <label id="Reset" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
          </label>
          </label>
          </asp:Label>

          </form>





          share|improve this answer

























          • Comments are not for extended discussion; this conversation has been moved to chat.

            – Samuel Liew
            Mar 7 at 22:42













          0












          0








          0







          Please try with this example



          protected void SelectedButtonChange(object sender, EventArgs e)

          if (RadioButtonList1.SelectedIndex > -1)

          lbllogin.Visible = false;
          lblSignup.Visible = false;
          lblReset.Visible = false;
          string selected = RadioButtonList5.SelectedItem.Value;
          switch (selected)

          case "signin":
          lbllogin.Visible = true;
          break;
          case "signup":
          lblSignup.Visible = true;
          break;
          case "reset":
          lblReset.Visible = true;
          break;







          and change your List with this in aspx code



           <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>


          Update
          I have change my code to this.. it is working from mine side, just check. and adjust validation etc message from yours.



          <form id="form1" runat="server">
          <div>
          <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>

          <%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
          </div>

          <asp:Label runat="server" id="lbllogin" visible="true">
          <label id="Login" class="Loginform">

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
          </label>
          </label>
          </asp:Label>
          <!-- Signup -->
          <asp:Label runat="server" id="lblSignup" visible="false">
          <label id="Naam" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
          </label>


          </label>


          <label id="Signin" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Repeat password">
          </asp:Label>

          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
          </label>
          </label>
          </asp:Label>
          <!-- Reset -->
          <asp:Label runat="server" id="lblReset" visible="false">
          <label id="Reset" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
          </label>
          </label>
          </asp:Label>

          </form>





          share|improve this answer















          Please try with this example



          protected void SelectedButtonChange(object sender, EventArgs e)

          if (RadioButtonList1.SelectedIndex > -1)

          lbllogin.Visible = false;
          lblSignup.Visible = false;
          lblReset.Visible = false;
          string selected = RadioButtonList5.SelectedItem.Value;
          switch (selected)

          case "signin":
          lbllogin.Visible = true;
          break;
          case "signup":
          lblSignup.Visible = true;
          break;
          case "reset":
          lblReset.Visible = true;
          break;







          and change your List with this in aspx code



           <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>


          Update
          I have change my code to this.. it is working from mine side, just check. and adjust validation etc message from yours.



          <form id="form1" runat="server">
          <div>
          <asp:RadioButtonList CssClass="Navigatieinlog" ID="RadioButtonList1" OnSelectedIndexChanged="SelectedButtonChange" runat="server" AutoPostBack="true">
          <asp:ListItem Text="Sign in" Value="signin"></asp:ListItem>
          <asp:ListItem Text="Sign up" Value="signup"></asp:ListItem>
          <asp:ListItem Text="Reset" Value="reset"></asp:ListItem>
          </asp:RadioButtonList>

          <%-- <asp:Button runat="server" OnClick="Unnamed_Click1" Text="check" />--%>
          </div>

          <asp:Label runat="server" id="lbllogin" visible="true">
          <label id="Login" class="Loginform">

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailinlog" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordlogin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Login" class="btn-draw" runat="server" Text="Log in" />
          </label>
          </label>
          </asp:Label>
          <!-- Signup -->
          <asp:Label runat="server" id="lblSignup" visible="false">
          <label id="Naam" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtNaam" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Voornaam"></asp:Label>
          </label>


          </label>


          <label id="Signin" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailsignin" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtPasswordsignin" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Password"></asp:Label>
          </label>

          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtpasswordsignrepeat" runat="server" TextMode="Password"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Repeat password">
          </asp:Label>

          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Sigin" class="btn-draw" runat="server" Text="Sign in" OnClick="Unnamed16_Click" />
          </label>
          </label>
          </asp:Label>
          <!-- Reset -->
          <asp:Label runat="server" id="lblReset" visible="false">
          <label id="Reset" class="Loginform">
          <label class="inlog">
          <asp:TextBox class="invoertype" ID="txtemailreset" runat="server"></asp:TextBox>
          <asp:Label class="invoertext" runat="server" Text="Email"></asp:Label>
          </label>

          <label class="buttonplacement">
          <asp:Button ValidationGroup="Reset" class="btn-draw" runat="server" Text="Reset" />
          </label>
          </label>
          </asp:Label>

          </form>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 7 at 12:39

























          answered Mar 7 at 9:48









          Faraz AhmedFaraz Ahmed

          581717




          581717












          • Comments are not for extended discussion; this conversation has been moved to chat.

            – Samuel Liew
            Mar 7 at 22:42

















          • Comments are not for extended discussion; this conversation has been moved to chat.

            – Samuel Liew
            Mar 7 at 22:42
















          Comments are not for extended discussion; this conversation has been moved to chat.

          – Samuel Liew
          Mar 7 at 22:42





          Comments are not for extended discussion; this conversation has been moved to chat.

          – Samuel Liew
          Mar 7 at 22:42

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038377%2fhow-to-loop-trough-radiobuttonlist-and-if-selected-show-content%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович