I have a Dropdown with two values "P" and "Q" with
AutoPostBack= true. I have another Custom WebControl called BDTextBox, this custom textbox have a Boolean property called LabelMode , on setting it to true would render the textbox as label.This LabelMode Property is set using ViewState and not using private variable.

    BDTexTbox.LabelMode = false;
    BdTextBox.LabelMode = true;

my need is that if Dropdown has value "P" the labelmode = false and on "Q" labelMode = true; my code looks somewhat like this.

I have tried writting this code in PanelCreation , OnPrerender but there seems to be a issue with it.

As i hit this code and suppose Dropdown value is "P" , it goes in if loop and as per code it sets value as false, that means it is not rendered as label.
But after the page is loaded completely it is rendered as label still that it has value of true in it.

Now if i change the Dropdown value to "Q" , it again hits code it goes in else loop and sets value of "true", but after page loads it is not rendered as label.

What is noticed that the value set is reflected in next postback. If if i set value as true and previously it was false, so once page is loaded it picks up older value and not which is set at runtime.

How the value set at runtime can be made to refelect in page in same postback itself ? why it reflects in next postback ? I guesss its somehting related to viewstate.

7 Years
Discussion Span
Last Post by aideveloper

Use like this and let me know,


sorry , that's what it is. it was typo error.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.