Client DataBind and DataFormatString

9 posts, 1 answers
  1. Henrique Duarte
    Henrique Duarte avatar
    104 posts
    Member since:
    Oct 2003

    Posted 20 Feb 2009 Link to this post

    Guys,

    The declarative client databind is working fine.
    My problem occurs when formatting a number ex. (DataFormatString=[0:N2])
    I'm from Brazil and here the group separator is "." and decimal separator is ",".
    How can I set the culture or format the data correctly on RadGrid?

    Regards,

    Henrique
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 23 Feb 2009 Link to this post

    Hello Henrique,

    I am sending you a small runnable application with the implementation request by you.
    Give it a try and see if it works for you.
    If you need additional directions, do not hesitate to let us know.

    Kind regards,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Henrique Duarte
    Henrique Duarte avatar
    104 posts
    Member since:
    Oct 2003

    Posted 23 Feb 2009 Link to this post

    Pavlina,

    I'm using a client-side databind.
    I know that using datasource, such AccessDataSource, works perfectly.
    To be more specific:
    http://blogs.telerik.com/blogs/09-02-09/RadTips_Episode_13_Using_Declarative_Client-Side_Databinding_in_the_RadGrid_for_ASP_NET_AJAX_Part_1.aspx

            <telerik:RadGrid ID="RadGrid1" runat="server" 
                AllowPaging="True"     
                AutoGenerateColumns="False"        
                EnableViewState="False" 
                PageSize="15"  
                Skin="Black"
                <ClientSettings> 
                    <DataBinding Location="BindDataOnClient.aspx"  
                        SelectCountMethod="GetProductCount"  
                        SelectMethod="GetProducts"
                    </DataBinding> 
                </ClientSettings> 
                <MasterTableView>                
                    <Columns>    
                        <telerik:GridBoundColumn DataField="Name"  
                            HeaderText="Product"   
                            UniqueName="ProductName"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CategoryName" 
                            HeaderText="Category"  
                            UniqueName="Category"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="Price" 
                            DataFormatString="[0:c]"  
                            HeaderText="Price"  
                            UniqueName="UnitPrice"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="UnitsInStock"   
                            HeaderText="Units"  
                            UniqueName="UnitsInStock"
                        </telerik:GridBoundColumn> 
                    </Columns> 
                </MasterTableView> 
            </telerik:RadGrid>         
     

    Try to change your culture to pt-BR and see if column Price changes.

    Regards,

    Henrique
  5. Answer
    Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 25 Feb 2009 Link to this post

    Hello Henrique,

    Can you please try setting RadScriptManager's EnableScriptGlobalization and EnableScriptLocalization properties to "true". Similar to the code snippet bellow:
    ASPX:
     <telerik:RadScriptManager ID="RadScriptManager1" EnableScriptLocalization="true" 
                EnableScriptGlobalization="true" runat="server">  
            </telerik:RadScriptManager> 

    ScriptManager.EnableScriptGlobalization Property
    Gets or sets a value that indicates whether the ScriptManager control renders script that supports parsing and formatting of culture-specific information.

    ScriptManager.EnableScriptLocalization Property
    Gets or sets a value that indicates whether theScriptManager control renders localized versions of script files.

    I hope this helps.

    Regards,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Rodrigo olivares
    Rodrigo olivares avatar
    9 posts
    Member since:
    Sep 2009

    Posted 28 Jan 2010 Link to this post

    The Datasource type and mode using for de DataBind ..(i' using a javascript to invoke a Webservice query and doing manually the dataBind on client) is important to the correct globalization?

    I have correctly configured the Culture, the flag actives in the ScriptManager, and al the things, but the numbers are displaying in en-US format.

    Thanks
  7. Rodrigo olivares
    Rodrigo olivares avatar
    9 posts
    Member since:
    Sep 2009

    Posted 29 Jan 2010 Link to this post

    I make a example to show the problem in a project, but I can not upload the file (zip)
  8. Simón
    Simón avatar
    21 posts
    Member since:
    Dec 2008

    Posted 29 Jan 2010 Link to this post

    In the forum only images can be attached. If you want to attach a sample project you need to open a support ticket.
  9. Rodrigo olivares
    Rodrigo olivares avatar
    9 posts
    Member since:
    Sep 2009

    Posted 29 Jan 2010 Link to this post

    Ok , no problem.

    Finally, the error was my mistake.

    I'm creating a RadGrid dinamically, setting the EnableLocalization and EnableGlobalization to true and did not worked, but I've been missed asign the DataFormatString on the column dinamically created. Before that, the grid mantains the direct value inject of value to the cell and do not make a "String.localeFormat"  to transform the value.

    thnks.





  10. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 01 Feb 2010 Link to this post

    Hi Rodrigo,

    I am glad to hear that you managed to solve the problem! In case you experience any other problems or you have additional questions, do not hesitate to contact us again!

    All the best,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017