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. Selected index change

Selected index change

Scheduled Pinned Locked Moved ASP.NET
csharpdatabase
6 Posts 4 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.
  • S Offline
    S Offline
    Shriya Kapoor
    wrote on last edited by
    #1

    why it is not wrking in (C#+Asp)n same code is working in Only c#. Is there any other event.. protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { TextBox2.Text = DropDownList1.Text; } respective text box is not getting updated. regards. shriya

    D D 2 Replies Last reply
    0
    • S Shriya Kapoor

      why it is not wrking in (C#+Asp)n same code is working in Only c#. Is there any other event.. protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { TextBox2.Text = DropDownList1.Text; } respective text box is not getting updated. regards. shriya

      D Offline
      D Offline
      Dinuraj
      wrote on last edited by
      #2

      try this TextBox2.Text = DropDownList1.SelectedIndex.Text;

      S 1 Reply Last reply
      0
      • D Dinuraj

        try this TextBox2.Text = DropDownList1.SelectedIndex.Text;

        S Offline
        S Offline
        Shriya Kapoor
        wrote on last edited by
        #3

        Error 1 'int' does not contain a definition for 'Text' D:\TIS\Default.aspx.cs 27 53 D:\TIS\ nops..this is the error..Shriya

        1 Reply Last reply
        0
        • S Shriya Kapoor

          why it is not wrking in (C#+Asp)n same code is working in Only c#. Is there any other event.. protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { TextBox2.Text = DropDownList1.Text; } respective text box is not getting updated. regards. shriya

          D Offline
          D Offline
          Deepalakshmi V
          wrote on last edited by
          #4

          To get the selected Text from the dropdownlist TextBox2.Text = DropDownList1.SelectedItem.Text; To get the selected Value from the dropdownlist TextBox2.Text = DropDownList1.SelectedValue; (or) TextBox2.Text = DropDownList1.SelectedItem.Value; Regards,

          Deepa

          S 1 Reply Last reply
          0
          • D Deepalakshmi V

            To get the selected Text from the dropdownlist TextBox2.Text = DropDownList1.SelectedItem.Text; To get the selected Value from the dropdownlist TextBox2.Text = DropDownList1.SelectedValue; (or) TextBox2.Text = DropDownList1.SelectedItem.Value; Regards,

            Deepa

            S Offline
            S Offline
            Shriya Kapoor
            wrote on last edited by
            #5

            thnx Deepa,, Through collection its 100% possible..The basic problem is there tht the event (DropDownList2_SelectedIndexChanged)is not fired on ..so the problem is arising.. else the associated code is absolutly running fine(TextBox2.Text = DropDownList2.Text; TextBox2.Text = DropDownList1.SelectedValue;). Both statments r crect Regards shriya

            N 1 Reply Last reply
            0
            • S Shriya Kapoor

              thnx Deepa,, Through collection its 100% possible..The basic problem is there tht the event (DropDownList2_SelectedIndexChanged)is not fired on ..so the problem is arising.. else the associated code is absolutly running fine(TextBox2.Text = DropDownList2.Text; TextBox2.Text = DropDownList1.SelectedValue;). Both statments r crect Regards shriya

              N Offline
              N Offline
              NasimKaziS
              wrote on last edited by
              #6

              Make the autopostback event property of the dropdownlist to true.. Have you placed the dropdownlist on the form or in a panel??

              where there is a will there is a way

              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