javascript - Text of textbox doesn’t update in submit button click -


i have 2 radiobutton. if 1 of them checked textbox active , data. in update page. in page-load fill them data database , check ispostback. if textbox have text in page load, text change , work fine if haven’t text in first place, keep default text , doesn’t update in submit button click.

    string val = "0";     if (radiobutton2.checked && textbox1.text.length != 0)             val = textbox1.text; 

in page load use code initialize radiobuttons:

    t.readonly = true;     t.backcolor = system.drawing.color.gray; 

and there's javascript code active , inactive textbox

    function checkedchanged(rbtnelement, txtelement) {                     if (document.getelementbyid(rbtnelement).checked) {                         document.getelementbyid(txtelement).readonly = false;                         document.getelementbyid(txtelement).style.backgroundcolor = "white";                     }                     else {                         document.getelementbyid(txtelement).readonly = true;                         document.getelementbyid(txtelement).style.backgroundcolor = "grey";                     }                 } 

it’s because textbox readonly property become false in c# code (it run in server side) , become true in javascript (it run in client side). in server side (c# codes) textbox remain readonly , don’t send text.

if remove 1 of them , manage textbox in 1 side (client or server) work fine.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -