Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. prblem on checkboxlist

prblem on checkboxlist

Scheduled Pinned Locked Moved ASP.NET
csharp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    biswa47
    wrote on last edited by
    #1

    i have a checkboxlistitem.where let say A,B,C,D,E are the items in that control. and below that 5textboxes are there named as textbox1,textbox2......textbox5. initiallay all textboxes are disabled.now i want when ever i select A the corresponding checkbox should be enable i.e textbox1. and likewise if i select B then textbox2, if Dthen textbox 4.likewise. what will be the vb.net code for it. (i have tried with if and elseif but its not working. as when the 1st condition is satisfied its coming out of the loop.)

    M I 2 Replies Last reply
    0
    • B biswa47

      i have a checkboxlistitem.where let say A,B,C,D,E are the items in that control. and below that 5textboxes are there named as textbox1,textbox2......textbox5. initiallay all textboxes are disabled.now i want when ever i select A the corresponding checkbox should be enable i.e textbox1. and likewise if i select B then textbox2, if Dthen textbox 4.likewise. what will be the vb.net code for it. (i have tried with if and elseif but its not working. as when the 1st condition is satisfied its coming out of the loop.)

      M Offline
      M Offline
      mihirhp
      wrote on last edited by
      #2

      hello... Try this out ... I had done in C# and convert it to vb Protected Sub CheckBoxList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) For i As Integer = 0 To CheckBoxList1.Items.Count - 1 Dim txt As String = "" If CheckBoxList1.Items(i).Selected Then txt = CheckBoxList1.Items(i).Text Select Case txt Case "A" TextBox1.Enabled = True Exit Select Case "B" TextBox2.Enabled = True Exit Select Case "C" TextBox3.Enabled = True Exit Select Case "D" TextBox4.Enabled = True Exit Select Case "E" TextBox5.Enabled = True Exit Select Case Else Exit Select End Select Else txt = CheckBoxList1.Items(i).Text Select Case txt Case "A" TextBox1.Enabled = False Exit Select Case "B" TextBox2.Enabled = False Exit Select Case "C" TextBox3.Enabled = False Exit Select Case "D" TextBox4.Enabled = False Exit Select Case "E" TextBox5.Enabled = False Exit Select Case Else Exit Select End Select End If Next End Sub

      1 Reply Last reply
      0
      • B biswa47

        i have a checkboxlistitem.where let say A,B,C,D,E are the items in that control. and below that 5textboxes are there named as textbox1,textbox2......textbox5. initiallay all textboxes are disabled.now i want when ever i select A the corresponding checkbox should be enable i.e textbox1. and likewise if i select B then textbox2, if Dthen textbox 4.likewise. what will be the vb.net code for it. (i have tried with if and elseif but its not working. as when the 1st condition is satisfied its coming out of the loop.)

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #3

        when ever i select A the corresponding **checkbox** should be enable TextBox or CheckBox ?????? apply all checkbox's ID as "amenities" and textboxes id like Amenities0,Amenities1,Amenities2,Amenities3......... function clickAll(e) { // deactivate other amenities var txtId="amenities"; for (var i = 0; i < e.form.elements.length; i++) { if (e.form.elements[i].name == "amenities") { txtId+=i; if(e.form.elements[i].checked == true) { document.GetElementById(txtId).style.display="block"; } else { document.GetElementById(txtId).style.display="none"; } } } return true; //Or return false; } If you got any error try to solve your self Best Regard Pathan

        ---------------------------------------------------

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups