?
Solved

CheckBoxList with textbox for Other choice

Posted on 2008-11-16
6
Medium Priority
?
2,159 Views
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!
0
Comment
Question by:qh0st
  • 4
6 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 22973527
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
 

Author Comment

by:qh0st
ID: 22976091
Can this be done with a checkboxlist control?
0
 

Author Comment

by:qh0st
ID: 23069627
Anyone there to help me? Please.
0
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 
LVL 13

Expert Comment

by:sm394
ID: 23070308
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
 

Author Comment

by:qh0st
ID: 23091366
This does not help me. I want to generate a textbox control in the same cell as the 'Other' checkbox selection.
1
 

Accepted Solution

by:
qh0st earned 0 total points
ID: 23354697
I was able to solve this by using CSS and aligning it near the 'Other' selection.
1

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

830 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