RadInputManager and Culture

2 posts, 0 answers
  1. aehlert
    aehlert avatar
    6 posts
    Member since:
    Aug 2007

    Posted 10 May 2013 Link to this post


    I am trying to figure out a way to change the culture attribute of items being loaded thru the RadInputManager.

    I'm using the methods I've found on the site to build the RadInputManager when a page is loaded.

    I use the Page_Init to add settings:

    protected void Page_Init(object sender, EventArgs e)
    {
        NumericTextBoxSetting numericSetting = new NumericTextBoxSetting();
        numericSetting.Validation.IsRequired = false;
        numericSetting.BehaviorID = "numeric";
        numericSetting.InitializeOnClient = true;
        RadInputManager1.InputSettings.Add(numericSetting);
     
        NumericTextBoxSetting _currencySetting = new NumericTextBoxSetting();
        _currencySetting.BehaviorID = "currency";
        _currencySetting.DecimalDigits = 2;
        _currencySetting.Type = NumericType.Currency;
        _currencySetting.Validation.IsRequired = false;
        _currencySetting.InitializeOnClient = true;
        RadInputManager1.InputSettings.Add(_currencySetting);
     
    }

    And apply it like:

    TextBox _txtTotal = (TextBox)e.Item.FindControl("txtTotal");
    RadInputManager1.InputSettings[1].TargetControls.Add(new TargetInput(_txtTotal.UniqueID, true));

    This works like a charm.  I want to change the culture of the rendered controls based on selections that the user places on the screen.  I can't do it on the Page_Init, however, because the data is not available at the time.

    Is there a way to change the culture after I've used the Page_Init to build the controls?
  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 14 May 2013 Link to this post

    Hello,

    The way suggested by Microsoft for dynamically changing the culture is by overriding the InitializeCulture. By that time you will need to access the value chosen by your user directly from the Request.Form. Here their documentation with example code:
    http://msdn.microsoft.com/en-us/library/bz9tc508%28v=vs.100%29.aspx

    Kind regards,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top