質問

so the short of the code is this

bool editable;

pageload()
{
    if (!ispostback)
    {
        editable = false; 
        aspTextbox.enable = editable;
    }
}

buttonclick()       
{
    editable = true;
    aspTextbox.enable = editable;
}

But explicitly setting the editable variable to true or setting it in the even handler for the button click neither of them are enabling the box. Is there another property used for this. or am i just missing something.

Thanks for comments and help. If you need more information just let me know in comments.

役に立ちましたか?

解決

You can do this way:

Place the below code in your <head> tag.

<script>
function disableText()
{
    document.getElementById("TextBox1").disabled=true;
}
function enableText()
{
    document.getElementById("TextBox1").disabled=false;
return false;
}
</script>

EDIT:

If you dont want to use javascript add a panel with textbox and enable/disable the panel.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top