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. the select control

the select control

Scheduled Pinned Locked Moved ASP.NET
questionsysadmintoolstutorial
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.
  • S Offline
    S Offline
    sara setare
    wrote on last edited by
    #1

    hi all, I am designing a website and I'm using the select control. I have two question: firs:how can I undrestand that user selected one options,I think that I should "onchanged" but it doesn't work! (onchange="salam" and it doesnt call the "salam" function) second: the number of options depends on the person Id, so it's not constant!How can I control the number of options dynamtically? as show below I have used this solution but it dosen't work. this is the piece of my code!

    reader = objcommand1.ExecuteReader();
    inti=reader.FieldCount;
    while (reader.Read())
    {
    if (i == 3)
    {
    </Script>
    <option value=""></option>
    <option id="post11" value="">0001</option>
    <option id="post21" value="">0002</option>
    <option id="post31" value="">0003</option>

    <script runat="server">
    break;
    }
    if( i == 2)
    {

                 </Script>
     <option value=""></option>
    <option  id="post12" value="">0001</option>
    

    ////and this is my another question that how to put the text of option dynamatically
    <option id="post22" value=""><script ">

                                reader.GetValue(1)</script></option>
                                             <script runat="server">
                                  }
    
    J 1 Reply Last reply
    0
    • S sara setare

      hi all, I am designing a website and I'm using the select control. I have two question: firs:how can I undrestand that user selected one options,I think that I should "onchanged" but it doesn't work! (onchange="salam" and it doesnt call the "salam" function) second: the number of options depends on the person Id, so it's not constant!How can I control the number of options dynamtically? as show below I have used this solution but it dosen't work. this is the piece of my code!

      reader = objcommand1.ExecuteReader();
      inti=reader.FieldCount;
      while (reader.Read())
      {
      if (i == 3)
      {
      </Script>
      <option value=""></option>
      <option id="post11" value="">0001</option>
      <option id="post21" value="">0002</option>
      <option id="post31" value="">0003</option>

      <script runat="server">
      break;
      }
      if( i == 2)
      {

                   </Script>
       <option value=""></option>
      <option  id="post12" value="">0001</option>
      

      ////and this is my another question that how to put the text of option dynamatically
      <option id="post22" value=""><script ">

                                  reader.GetValue(1)</script></option>
                                               <script runat="server">
                                    }
      
      J Offline
      J Offline
      Joshua Omundson
      wrote on last edited by
      #2

      For your first question, you can use the onselectedindexchanged event. For your second question, if you are storing the option values in a database, you can pull the results based on the person Id and databind it to the drop down list.

      R 1 Reply Last reply
      0
      • J Joshua Omundson

        For your first question, you can use the onselectedindexchanged event. For your second question, if you are storing the option values in a database, you can pull the results based on the person Id and databind it to the drop down list.

        R Offline
        R Offline
        Rockstar_
        wrote on last edited by
        #3

        I agree...

        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