3 Replies - 977 Views - Last Post: 24 December 2012 - 02:18 PM Rate Topic: -----

#1 JohnOneill00  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 04-June 12

Getting Text To Appear Depending On Drop Down List Choice ?

Posted 24 December 2012 - 11:24 AM

As The Title Says I'm Such With Getting An Event To Occur Depending On The Item Selected In The Drop Down List.

Following Code Used:

Protected Sub DropDownList1_TextChanged(sender As Object, e As System.EventArgs) Handles DropDownList1.TextChanged
        If DropDownList1.Text = "super" Then
            TextBox1.Text = "john"
            TextBox1.Text.ToString()

        End If
      End Sub


Also Tried:

Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
       Dim selected As String = DropDownList1.SelectedItem.ToString

        If selected = "super" Then

            TextBox1.Text = "john"
            TextBox1.Text.ToString()
        End If
      End Sub



Tried Other Ways Also But Nothing Worked. Any Help Will Be Amazing.

Thanks

John

Is This A Good Question/Topic? 0
  • +

Replies To: Getting Text To Appear Depending On Drop Down List Choice ?

#2 souptoy  Icon User is offline

  • D.I.C Head


Reputation: 54
  • View blog
  • Posts: 244
  • Joined: 17-January 08

Re: Getting Text To Appear Depending On Drop Down List Choice ?

Posted 24 December 2012 - 12:05 PM

Have you set up your DropDownList1 to listen for the SelectedIndexChanged event in the UI side as well as set AutoPostBack = true?

<asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="true" onselectedIndexChanged="DropDownList1_SelectedIndexChanged" />



Note: Line 4 in DropDownList1_TextChanged & 7 in DropDownList1_SelectedIndexChanged does nothing since it's not being assigned to anything.
Was This Post Helpful? 1
  • +
  • -

#3 JohnOneill00  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 04-June 12

Re: Getting Text To Appear Depending On Drop Down List Choice ?

Posted 24 December 2012 - 12:44 PM

Ahhh Thanks For The Reply...Infact This Sloved My Issue.

Thanks A Million

John
Was This Post Helpful? 0
  • +
  • -

#4 souptoy  Icon User is offline

  • D.I.C Head


Reputation: 54
  • View blog
  • Posts: 244
  • Joined: 17-January 08

Re: Getting Text To Appear Depending On Drop Down List Choice ?

Posted 24 December 2012 - 02:18 PM

Glad to help :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1