Event/CutulreInfo/Sorting problem. Only for pros

G

Guest

We have come across a situation that I thinks not many have.

Grateful for all responses.

Regards Maran

*************

* Scenario
A DataList binds to a DataRow[], with "RegionName" och "RegionShortName",
sorted on "RegionName".

When the user saves changes, the controls in each DataListItem in the
DataList is fetched by FindControl and the text from "Region Name" is saved.

* Problem
When there is values in "RegionName" containing "w " och "v " (those letters
and a space), in the same postion and the rows after each other, the other
column, "RegionShortName", is sorted incorrectly for those rows.

"RegionName" is correkt in both cases, but their "RegionShortName", which
contains "w " or "v ", have been shifted.

The data is bound/shown correctly for both CultureInfo when displaying the
datalist, it is only when looping the controls the error shows.

**** Sample ****
Correct after LoadViewState (in a PostBack)
Row, Region Name (TextBox), Region Short Name (Label)
34, HJKL, New Mexico
35 NY, Nev York (Misspelled on purpose)
36, NV, Nevada

Incorrect in Save_OnClick (in a PostBack)
Row, Region Name (TextBox), Region Short Name (Label)
34, NY, New Mexico
35 NV, Nev York (Felstavat med flit)
36, HJKL, Nevada

* So far
- The problem depends on users choice of CultureInfo. The users using
English settings have no problem, those who have Swedish settings have this
problem.
- "View source" shows that the controls are rendered correctly.
- In Postback, when saving, the controls are populated in LoadViewState with
data from ViewState and DataBind() on the DataList. Here are the DataLsit's
control tree correct.
- After LoadViewState the save button event is run and when before anything
is done the DataList's control tree is incorrect
- The problem does not occur if we change "RegionShortName"'s Label to a
TextBox. This makes me think it has something to do with posted object, since
Labels are not included there.
- We have tested to override several events and examined the DataList's
control tree, but nothing found.

* Other
- The DataList is not using ViewState. LoadViewState populates the DataList,
which is checked and ok.
- There is no other sorting than when creating the DataRow[].
- In Global.asax we set the users CultureInfo with
Thread.CurrentThread.CurrentCulture = new CultureInfo(...) in
Application_AuthenticateRequest.
- We have fixed the problem temporarily by changing the Label to a disabled
TextBox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top