CheckBoxList with textbox for Other choice

Posted on 2008-11-16
Last Modified: 2013-11-08
Hi Gurus,

I have a list of choices with "Other" being the last choice of the list. For this choice, a user MUST enter a value into the textbox. How do I go about inserting a textbox control for only the "Other" choice?

Choice 1
Choice 2
Choice 3
Other Choice:  [ text box here ]

Thanks in advance!
Question by:qh0st
    LVL 39

    Expert Comment

    by:Pratima Pharande
    try this


    <asp:CheckBox ID="CheckBox1" runat="server" />
            <asp:CheckBox ID="CheckBox2" runat="server" />
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
            <asp:Button ID="Button1" runat="server" Text="Button"  />

    at codebehind add on page_load

     Button1.Attributes.Add("onclick", "return check()")


     <script language="javascript" type="text/javascript">
        function check()
         if ( document.getElementById("CheckBox2").checked == true)

           if(document.getElementById("TextBox1").value == "")
              alert("Please enter value");
              return false;

    Author Comment

    Can this be done with a checkboxlist control?

    Author Comment

    Anyone there to help me? Please.
    LVL 13

    Expert Comment

    have a look at this accepted solution only difference is its done using radiobuttonlist

    Author Comment

    This does not help me. I want to generate a textbox control in the same cell as the 'Other' checkbox selection.

    Accepted Solution

    I was able to solve this by using CSS and aligning it near the 'Other' selection.

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now