0

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

Edited by maxpaine69

2
Contributors
5
Replies
20
Views
3 Years
Discussion Span
Last Post by maxpaine69
0

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

0

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();
    }
})
0

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

Edited by maxpaine69

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.