Pager Text Not changing on localization

4 posts, 0 answers
  1. fred williams
    fred williams avatar
    55 posts
    Member since:
    Feb 2010

    Posted 14 Jul Link to this post

    So I have a grid inside an asp update panel. I have a dropdown list with differnet cultutres on the master page. In the need data source event handler for the grid, I check the value of the dropdown like so

        Protected Sub grid_NeedDataSource(ByVal sender As Object, ByVal e As GridNeedDataSourceEventArgs) Handles grid.NeedDataSource
            PopulateGrid(False)
            Dim ddl As New DropDownList()
            Dim strLanguage As String
            ddl = CType(Me.Master.FindControl("ddlLanguage"), DropDownList)
            strLanguage = ddl.SelectedValue
            If strLanguage Is Nothing Or strLanguage.Length = 0 Then
                strLanguage = "en-US"
            End If
            Dim newCulture As CultureInfo = CultureInfo.CreateSpecificCulture(strLanguage)
            gridVirtualPoints.Culture = newCulture
        End Sub

    Here is the PopulateGrid method called in the first line of the above method

        Private Sub PopulateGrid(ByVal reload As Boolean)
            If CurrentUser.isAdmin Or CurrentUser.isParent Then
                Dim Customers = dal.SelectCustomersByCustomerID(CurrentCustomer.CustomerID)
                Dim CustomerIDs As New List(Of String)

                For Each Customer As Customer In Customers
                    If Not Customer Is Nothing Then
                        CustomerIDs.Add(Customer.CustomerID)
                    End If
                Next
            //this just gets the data from the database
                grid.DataSource = dal.getgriddata(CustomerIDs)
            Else
                grid.DataSource = dal.getgriddata(CurrentUser.UserID)
            End If

            If reload Then
                grid.DataBind()
            End If
        End Sub

     

    When I change the dropdown from the masterpage to a different language, it changes all the other values in the resx file except the page text. The really weird part is, if I change the dropdown value again it then updates the pager text to what it should have been the first time. So in other words

    1. change from english to french. All the text from the resx file EXCEPT the PagerText changes.

    2. Change back to English. All the text from the english rex file change correctly, and the pagertext now changes to the french pager text from the resx file. 

    Could this have something to do with the asp update panel?

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1796 posts

    Posted 19 Jul Link to this post

    Hi Fred,

    The OnNeedDataSource event seems to be too late in the page's life cycle and that is why the culture is changed on the second postback. I would suggest that you follow the approach from the following online demo for changing the culture:
    As you will notice, you just need to change the RadioButtonList with the DropDownList control and initiate a postback when you change the selection in that control.

    Hope this helps.


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. fred williams
    fred williams avatar
    55 posts
    Member since:
    Feb 2010

    Posted 19 Jul in reply to Konstantin Dikov Link to this post

    Hi,

    Thanks for the reply. Will this work inside an asp update panel? The page I'm dealing with know wraps everything inside an update panel.

  5. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1796 posts

    Posted 22 Jul Link to this post

    Hello Fred,

    If the DropDown control and the RadGrid are within the same UpdatePanel, the same approach should work correctly.

    Just on a side note, if you have more complex scenario and you need more flexible AJAX settings on your page, you could take advantage of our RadAjaxManager control:


    Best Regards,
    Konstantin Dikov
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top