optgroup

Hello C# gurus!

Does anyone know of how to build a dropdownlist with 'optgroup' tags using C#

Many thanks
ice



Answer this question

optgroup

  • Nissan

    Hello again,

    It turns out that google is my friend after all and so are some French dudes too. Here's the code in case anyone searches here for the same thing...

    1. function suppression_optgroup(id_du_optgroup)
    2. {
    3. var ie = false; /*@cc_on ie = true; @*/
    4. var q=document.getElementById(id_du_optgroup);
    5. if (q)
    6. {
    7. if ( ie ) {
    8. q.outerHTML=null;
    9. }
    10. else {
    11. q.innerHTML=null;
    12. q.label=null;
    13. }
    14. }
    15. }
    16. function ajout_optgroup(mon_formulaire,ma_liste)
    17. {
    18. objSelect=document.forms(mon_formulaire).elements(ma_liste);
    19. optGroup = document.createElement('optgroup')
    20. optGroup.label = "nom_du_optgroup"
    21. objOption1=document.createElement("option")
    22. objOption1.innerHTML = "nom_option1"
    23. objOption1.value = "valeur_option1"
    24. objOption2=document.createElement("option")
    25. objOption2.innerHTML = "nom_option2"
    26. objOption2.value = "valeur_option2"
    27. objSelect.appendChild(optGroup)
    28. optGroup.appendChild(objOption1)
    29. optGroup.appendChild(objOption2)
    30. }

  • optgroup