This is a migrated thread and some comments may be shown as answers.

Client DataBind and DataFormatString

8 Answers 378 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henrique Duarte
Top achievements
Rank 1
Veteran
Henrique Duarte asked on 20 Feb 2009, 05:54 PM
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

8 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 23 Feb 2009, 04:16 PM
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.
0
Henrique Duarte
Top achievements
Rank 1
Veteran
answered on 23 Feb 2009, 06:48 PM
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
0
Accepted
Pavlina
Telerik team
answered on 25 Feb 2009, 02:41 PM
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.
0
Rodrigo olivares
Top achievements
Rank 1
answered on 28 Jan 2010, 10:31 PM
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
0
Rodrigo olivares
Top achievements
Rank 1
answered on 29 Jan 2010, 02:08 PM
I make a example to show the problem in a project, but I can not upload the file (zip)
0
Simón
Top achievements
Rank 1
answered on 29 Jan 2010, 06:28 PM
In the forum only images can be attached. If you want to attach a sample project you need to open a support ticket.
0
Rodrigo olivares
Top achievements
Rank 1
answered on 29 Jan 2010, 09:04 PM
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.





0
Pavlina
Telerik team
answered on 01 Feb 2010, 02:58 PM
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.
Tags
Grid
Asked by
Henrique Duarte
Top achievements
Rank 1
Veteran
Answers by
Pavlina
Telerik team
Henrique Duarte
Top achievements
Rank 1
Veteran
Rodrigo olivares
Top achievements
Rank 1
Simón
Top achievements
Rank 1
Share this question
or