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
  1. Home
  2. Web Development
  3. ASP.NET
  4. Display a table based on the selected ListItem

Display a table based on the selected ListItem

Scheduled Pinned Locked Moved ASP.NET
question
5 Posts 2 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.
  • N Offline
    N Offline
    n_gchaitra
    wrote on last edited by
    #1

    Hi, I want to display a table based on the selected item of the listbox. Say I have two tables "Ftable" and "Stable". If item in the listbox is "First" then Ftable should get displayed else Stable should be displayed. I tried, If listbox.selecteditem="First" Then Ftable.visible=true else Stable.visible=true EndIf But it is not working, How else can I do this? Thank you in advance.

    Chaitra N

    M 1 Reply Last reply
    0
    • N n_gchaitra

      Hi, I want to display a table based on the selected item of the listbox. Say I have two tables "Ftable" and "Stable". If item in the listbox is "First" then Ftable should get displayed else Stable should be displayed. I tried, If listbox.selecteditem="First" Then Ftable.visible=true else Stable.visible=true EndIf But it is not working, How else can I do this? Thank you in advance.

      Chaitra N

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      Did you set "AutoPostBack" to true in the properties of ListBox? What error are you getting?

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

      N 1 Reply Last reply
      0
      • M Michael Sync

        Did you set "AutoPostBack" to true in the properties of ListBox? What error are you getting?

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

        N Offline
        N Offline
        n_gchaitra
        wrote on last edited by
        #3

        I am not getting any errors. But it just not working. I tried the following code also. But of no use. Protected Sub lstselectedtest_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstselectedtest.SelectedIndexChanged Dim test As String test = lstselectedtest.SelectedItem.ToString() If test.StartsWith("Pulse Pressure") = True Then Tbpulse.Visible = True bindlist() Else TbOth.Visible = True End If End Sub

        Chaitra N

        M 1 Reply Last reply
        0
        • N n_gchaitra

          I am not getting any errors. But it just not working. I tried the following code also. But of no use. Protected Sub lstselectedtest_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstselectedtest.SelectedIndexChanged Dim test As String test = lstselectedtest.SelectedItem.ToString() If test.StartsWith("Pulse Pressure") = True Then Tbpulse.Visible = True bindlist() Else TbOth.Visible = True End If End Sub

          Chaitra N

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          As I wrote:

          Did you set "AutoPostBack" to true in the properties of ListBox?

          You have to set this property to true to fire "SelectedIndexChanged" event. Set the breakpoint to this event and check whether this event is fired or not.. if it is not invoked, you need to set AutoPostBack property to true..

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

          N 1 Reply Last reply
          0
          • M Michael Sync

            As I wrote:

            Did you set "AutoPostBack" to true in the properties of ListBox?

            You have to set this property to true to fire "SelectedIndexChanged" event. Set the breakpoint to this event and check whether this event is fired or not.. if it is not invoked, you need to set AutoPostBack property to true..

            Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

            N Offline
            N Offline
            n_gchaitra
            wrote on last edited by
            #5

            I set the AutoPostBack to "True". It is working now. Thank you.

            Chaitra N

            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