CheckBoxList with textbox for Other choice

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!
qh0stAsked:
Who is Participating?
 
qh0stConnect With a Mentor Author Commented:
I was able to solve this by using CSS and aligning it near the 'Other' selection.
1
 
Pratima PharandeCommented:
try this

HTML

<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()")

Javascript

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

       if(document.getElementById("TextBox1").value == "")
       {
          alert("Please enter value");
          document.getElementById("TextBox1").focus();
          return false;
       }
     }
    }
</script>
0
 
qh0stAuthor Commented:
Can this be done with a checkboxlist control?
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
qh0stAuthor Commented:
Anyone there to help me? Please.
0
 
sm394Commented:
have a look at this accepted solution only difference is its done using radiobuttonlist
http://www.experts-exchange.com/Programming/Languages/.NET/Q_23900094.html
0
 
qh0stAuthor Commented:
This does not help me. I want to generate a textbox control in the same cell as the 'Other' checkbox selection.
1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.