Event order handling

  • Thread starter Thread starter Xela
  • Start date Start date
X

Xela

Hi all,

I have radio button list in a user control which when
selection changed fire an event which will modify the
current Thread culture.

This user control is on general page which contain one
dropdown list and typical calendar.

Clicking on the radio button did effectively modify the
calendar culture aspect, but not the dropdown (list
displayed depend on the culture)
Clicking another time make the change on the list but with
onr round-trip late.

When I look at the order the events are processed, my
selectedIndexChanged for the radio button list is the last
to be processed (seems normal as seen on MS site), which
explain previous behavior.

So my question is how to emulate the behavior of the
Calendar control, since the Load event for each control is
done first?


Thank you very much for your support
Xela
 
Hi Xela,

I'm not really clear on your problem. Is it possible that you need to clear the
dropdownlist and then re-add the items in the appropriate culture? Perhaps you
could show us the code that isn't working?

At any rate, the code below seems to set the culture setting of the dropdown
list items.

Ken
MVP [ASP.NET]

Private Sub radFrench_CheckedChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles radFrench.CheckedChanged
Dim ci As CultureInfo = _
New CultureInfo("fr-CA")
Thread.CurrentThread.CurrentCulture = ci
' Display the name of the culture
txtCulture.Text = Thread.CurrentThread. _
CurrentCulture.EnglishName
' Refresh the display of the data
With DropDownList1.Items
.Clear()
.Add("Display Name: " & ci.DisplayName)
.Add("English Name: " & ci.EnglishName)
.Add("Native Name: " & ci.NativeName)
' Get day names
.Add("Day Names:")
Dim strDayNames() As String = _
ci.DateTimeFormat.DayNames
Dim strDay As String
For Each strDay In strDayNames
.Add(" " & strDay)
Next
' Get the current year
.Add("Current year: " & ci.Calendar. _
GetYear(DateTime.Today))
' And the currency symbol
.Add("Currency symbol: " & _
ci.NumberFormat.CurrencySymbol)
End With
End Sub


--
Microsoft MVPs have a question for *you*: Are you patched against the Worm?
http://www.microsoft.com/security/security_bulletins/ms03-026.asp



Hi all,

I have radio button list in a user control which when
selection changed fire an event which will modify the
current Thread culture.

This user control is on general page which contain one
dropdown list and typical calendar.

Clicking on the radio button did effectively modify the
calendar culture aspect, but not the dropdown (list
displayed depend on the culture)
Clicking another time make the change on the list but with
onr round-trip late.

When I look at the order the events are processed, my
selectedIndexChanged for the radio button list is the last
to be processed (seems normal as seen on MS site), which
explain previous behavior.

So my question is how to emulate the behavior of the
Calendar control, since the Load event for each control is
done first?


Thank you very much for your support
Xela
 
I found a solution which solve the problem:
do not use the page_load of the user control, but use the
prerender event.

I do not know if it a fine solution, but it works.
It also allow me to understand a bit more the way asp.net
pages are processed.

Anyway thanks for your support.

Xela
 
Back
Top