L
Lagrange
Hello,
I'll try to describe my problem in simplest possible way.
I have:
- FormView databound via LinqDataSource (linq to sql)
- 2 DropDownLists (A, B) inside FormView's EditTemplate
- both A and B 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), however, I was not able to go any further as I encountered essential
problems. These can be characterized by specific behavior of DDLs (while
inspecting the behavior, A and B are not hierarchically bound yet):
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 (!) (Only A should fire SelectedIndexChanged event)
II. Suppose that both DDLs have selected index other than 0. Change
selection in A to index 0. B and ONLY B will fire SelectedIndexChanged event
(!) (Only A should 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 (!) (Only A should fire SelectedIndexChanged event)
(You can swap A and B in previous tests, none of them is significant.)
Conclusion: Every DDL is firing SelectedIndexChanged on every Postback (no
matter which one caused the PostBack) with one exception - when DDL's
selected index is or has been changed to 0.
Theorization: Server databinds each DDL on every postback (this is really
true for databound DDL inside databound ViewForm) dropping information about
originally selected index of DDL replacing it with default 0. Server then
does not compare originally selected value with new 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
new currently selected value coming from viewstate. Outcome is as described
above. This is just my theory, I have not approve it by debugging at
sufficient level of details.
Behavior described above is completely inappropriate as a basis for building
hierarchically bound DDLs as I need SelectedIndexChanged of A to re-databind
B to create hierarchical pair of dropdownlists. It completely invalidates
SelectedIndexChanged event as an indication of DDL's selected index change.
Do you have some suggestions how to resolve this issue?
Many thanks.
Peter.
I'll try to describe my problem in simplest possible way.
I have:
- FormView databound via LinqDataSource (linq to sql)
- 2 DropDownLists (A, B) inside FormView's EditTemplate
- both A and B 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), however, I was not able to go any further as I encountered essential
problems. These can be characterized by specific behavior of DDLs (while
inspecting the behavior, A and B are not hierarchically bound yet):
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 (!) (Only A should fire SelectedIndexChanged event)
II. Suppose that both DDLs have selected index other than 0. Change
selection in A to index 0. B and ONLY B will fire SelectedIndexChanged event
(!) (Only A should 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 (!) (Only A should fire SelectedIndexChanged event)
(You can swap A and B in previous tests, none of them is significant.)
Conclusion: Every DDL is firing SelectedIndexChanged on every Postback (no
matter which one caused the PostBack) with one exception - when DDL's
selected index is or has been changed to 0.
Theorization: Server databinds each DDL on every postback (this is really
true for databound DDL inside databound ViewForm) dropping information about
originally selected index of DDL replacing it with default 0. Server then
does not compare originally selected value with new 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
new currently selected value coming from viewstate. Outcome is as described
above. This is just my theory, I have not approve it by debugging at
sufficient level of details.
Behavior described above is completely inappropriate as a basis for building
hierarchically bound DDLs as I need SelectedIndexChanged of A to re-databind
B to create hierarchical pair of dropdownlists. It completely invalidates
SelectedIndexChanged event as an indication of DDL's selected index change.
Do you have some suggestions how to resolve this issue?
Many thanks.
Peter.