P
peter.drienovsky
Hello,
I'll try to describe my problem in simplest possible terms.
I have:
- FormView databound via LinqDataSource (linq to sql)
- 2 DropDownList (A, B) inside FormView's EditTemplate, both databound
using 2 different LinqDataSources (also linq to sql)
- A and B has AutoPostback and EnableViewstate set to 'true'
My final intention is to make hierarchical DDLs (citiest in A, streets
in B for instance), however, I was not able to go so far as I
encountered essential problems. These can be characterized by specific
behavior of DDLs:
I.
Suppose that both DDLs have selected index other than 0.
Change selection in A to some index other than 0.
Then both DDLs will fire SelectedIndexChanged event (!)
II.
Suppose that both DDLs have selected index other than 0.
Change selection in A to index 0.
Only B will fire SelectedIndexChanged event (!)
III.
Suppose that A has selected index other than 0 while B has selected
index 0.
Change selection in A to index 0.
None of DDLs will fire SelectedIndexChanged event (!)
Conclusion:
Every DDL is firing SelectedIndexChanged on every Postback (no matter
if it is reason of PostBack) with one exception - when it's selected
index is or has been changed to 0.
Theorization:
Server databind DDL on every postback (this is really true for DDL
inside ViewForm) dropping information about originally selected index
of DDL replacing it with default 0.
Server then does not compare originally selected value with currently
selected value coming from viewstate to figure out if
SlectedIndexChange should fire, but it compares right-after-binding
default 0 value of selected index of DDL with currently selected value
coming from viewstate. Outcome is as described above.
This is just my theory, I have not approve it by debugging to
necessary level of details.
Be it so or not.... what a mess : (
I need SelectedIndexChanged of A to re-databind B to create
hierarchical pair of dropdownlists.
However, behavior described above is completely inappropriate as a
basis for building such a mechanism.
Do you guys have some suggestions hove to resolve this?
Many thanks.
Peter.
I'll try to describe my problem in simplest possible terms.
I have:
- FormView databound via LinqDataSource (linq to sql)
- 2 DropDownList (A, B) inside FormView's EditTemplate, both databound
using 2 different LinqDataSources (also linq to sql)
- A and B has AutoPostback and EnableViewstate set to 'true'
My final intention is to make hierarchical DDLs (citiest in A, streets
in B for instance), however, I was not able to go so far as I
encountered essential problems. These can be characterized by specific
behavior of DDLs:
I.
Suppose that both DDLs have selected index other than 0.
Change selection in A to some index other than 0.
Then both DDLs will fire SelectedIndexChanged event (!)
II.
Suppose that both DDLs have selected index other than 0.
Change selection in A to index 0.
Only B will fire SelectedIndexChanged event (!)
III.
Suppose that A has selected index other than 0 while B has selected
index 0.
Change selection in A to index 0.
None of DDLs will fire SelectedIndexChanged event (!)
Conclusion:
Every DDL is firing SelectedIndexChanged on every Postback (no matter
if it is reason of PostBack) with one exception - when it's selected
index is or has been changed to 0.
Theorization:
Server databind DDL on every postback (this is really true for DDL
inside ViewForm) dropping information about originally selected index
of DDL replacing it with default 0.
Server then does not compare originally selected value with currently
selected value coming from viewstate to figure out if
SlectedIndexChange should fire, but it compares right-after-binding
default 0 value of selected index of DDL with currently selected value
coming from viewstate. Outcome is as described above.
This is just my theory, I have not approve it by debugging to
necessary level of details.
Be it so or not.... what a mess : (
I need SelectedIndexChanged of A to re-databind B to create
hierarchical pair of dropdownlists.
However, behavior described above is completely inappropriate as a
basis for building such a mechanism.
Do you guys have some suggestions hove to resolve this?
Many thanks.
Peter.