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. Its Problem or my mistake

Its Problem or my mistake

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasehelpquestion
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.
  • A Offline
    A Offline
    ANKUR22
    wrote on last edited by
    #1

    I am New to .net , in my project I am using one dropdownlist and using its (selecteditem.text)value and selectedvalue both.Now the problem is that selectedtext i.e stnno is unique but its selectedvalue is date and not unique if i select the third value from dropdown whose postback=true then it is returing the value of first record because the selectedvalue i.e date is same for both the index what can I do.???????????? Ankur

    C G 2 Replies Last reply
    0
    • A ANKUR22

      I am New to .net , in my project I am using one dropdownlist and using its (selecteditem.text)value and selectedvalue both.Now the problem is that selectedtext i.e stnno is unique but its selectedvalue is date and not unique if i select the third value from dropdown whose postback=true then it is returing the value of first record because the selectedvalue i.e date is same for both the index what can I do.???????????? Ankur

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Not sure I follow 100%, but if your control is databound, and you bind on postback, your selection will be lost. Put your DataBind code inside a if(!IsPostback) block

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • A ANKUR22

        I am New to .net , in my project I am using one dropdownlist and using its (selecteditem.text)value and selectedvalue both.Now the problem is that selectedtext i.e stnno is unique but its selectedvalue is date and not unique if i select the third value from dropdown whose postback=true then it is returing the value of first record because the selectedvalue i.e date is same for both the index what can I do.???????????? Ankur

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        The values of the options are supposed to be unique. The only thing that is sent back from the browser in the postback is the value of the selected option, so if the values are not unique, you can't know which option was really selected. If you really can't use unique values, you have to handle the detection of the selected option all by yourself. You can put a Javascript in the onsubmit event in the form, that gets the selectedIndex from the html element that the dropdownlist generates, and puts it in a hidden field.

        --- single minded; short sighted; long gone;

        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