| |

VerySource

 Forgot password?
 Register
Search
Author: prince_l

Client-side JavaScript changes the items of the asp.net Dropdownlist control, how to get the selected value in the backg

[Copy link]

3

Threads

10

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-4-13 19:00:01
| Show all posts
provincetemp
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-31 19:45:01
| Show all posts
capalexmethod, yes. Thank you.
To express my gratitude, let me provide java script.
    function changeQryType() {
        var st=document.all["cbx_QryType"].value;
        var lbl=document.all["lbl_Value2"];
        var cbx=document.all["cbx_Value2"];
        var i=0;
        var now=new Date();
        //visible
        lbl.style.display="block";
        cbx.style.display="block";
        //Set its display content
        cbx.length=0; //Clear items
        if (st=="month") {
            lbl.innerText="Month:"; //Refer to the webpage: http://www.e2web.cn/etemp/001/47789.htm
            for (i=1; i<=12; i++) {
                cbx.add( new Option(i, i, true, true) ); //Add item
            }
            cbx.value=now.getMonth(); //value
        }
        else if (st=="season") {
            lbl.innerText="Quarter:";
            for (i=1; i<=4; i++) {
                cbx.add( new Option(i, i, true, true) );
            }
            cbx.value="1";
        }
        else if (st=="halfyear") {
            lbl.innerText="Half a year:";
            cbx.add( new Option("First half", "上", true, true) );
            cbx.add( new Option("Second Half Year", "Next", true, true) );
            cbx.value="上";
        }
        else {
            lbl.style.display="none";
            cbx.style.display="none";
        }
        return true;
    }
    //initialization
    function initForm() {
        var i=0;
        var cbx=document.all["cbx_Year"];
        var now=new Date();
        var s=now.getYear();
        for (i=1990; i<=2500; i++) cbx.add( new Option(i, i, true, true) );
        cbx.value=s;
        //
        changeQryType();
    }
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list