How to get value when placing attribute enable false c # aspx [closed]

-1

Good evening, I would like you to help me, I have a combobox that by default has a value of 4 and in codebing it is placed in the load combobox.enable = false;

But when you save that value that is 4, you put 0

As if that enable whites the value I would like you to help me and you can not eliminate the value when that combo is an enable.

I tried to remove the enable and if it manages to save the default value that it has set.

I'm doing in aspx c #

    
asked by PieroDev 29.09.2017 в 05:58
source

1 answer

1

When you lose the value of the combo it is most likely that you are loading the control items in the webform's Load, but do not do it within IsPostBack , your code should be

public void Form1_Load(...)
{
    if(!IsPostBack){
       //aqui asignas el datasource del combo
    }
}

If you put the code that assigns the data in that block when the post occurs due to an event, you will lose the selection

    
answered by 29.09.2017 в 20:47