Professional Web Applications Themes

Event order handling - ASP.NET General

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 ...

  1. #1

    Default Event order handling

    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

    Xela Guest

  2. #2

    Default Re: Event order handling

    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



    "Xela" <com> wrote in message
    news:032a01c36aaa$7a2956e0$gbl...
    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


    Ken Guest

  3. #3

    Default Re: Event order handling

    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
     
    you need to clear the 
    culture? Perhaps you 
    setting of the dropdown 
    against the Worm? 
    026.asp 
    Xela Guest

Similar Threads

  1. Event Handling
    By John Bankhead in forum ASP.NET Building Controls
    Replies: 0
    Last Post: June 24th, 05:48 PM
  2. order of Event Handling and Posting Page_Load..?
    By cj in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: May 13th, 04:38 PM
  3. ASP.NET Event handling.
    By Makarand in forum ASP.NET General
    Replies: 0
    Last Post: July 24th, 01:46 PM
  4. ASP Event Handling
    By Anuj in forum ASP Components
    Replies: 2
    Last Post: July 18th, 08:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139