Hi all,

I have a asp:radiobuttonlist, that the data to create it comes from the Database,

one of the option must turn visible, a text box, i have that done in codebehind in .net, but i think its lagging to much.

the problem is how can i do thins in pure javascript.

best regards

Recommended Answers

Do you have sample code (just relevant code)? Should be fairly easy to use the onclick event for this.

Jump to Post

I dont understand your last post.

Here is a simple example although it leverages jQuery which really simplifies what you are trying to do.

If you click on one the choices, an alert message is displayed with the selected value. You can easily expand this so that if a certain …

Jump to Post

All 5 Replies

Do you have sample code (just relevant code)? Should be fairly easy to use the onclick event for this.

proble onclin where is it in asp:radiobuttonlist??

I dont understand your last post.

Here is a simple example although it leverages jQuery which really simplifies what you are trying to do.

If you click on one the choices, an alert message is displayed with the selected value. You can easily expand this so that if a certain item is selected (with a conditional statement), then change the display property of the textbox (.show() method with jQuery).

<asp:RadioButtonList ID="RadioButtonList1" runat="server" >
    <asp:ListItem Text="1" Value="1"></asp:ListItem>
    <asp:ListItem Text="2" Value="2"></asp:ListItem>
    <asp:ListItem Text="3" Value="3"></asp:ListItem>
</asp:RadioButtonList>

<script>
$("input[type='radio']").click(function () {
    alert($(this).val());

    if (condition is true)
    {
        $('#txtBox1').show();
    }
})

thats jquery, not pure javascript, more the radiobutton its created from a database.

Any ideas anybody

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.