Hi, I can´t get the WebDataGrid displaying numeric data with format.
<ig:WebDataGrid ID="grdResultados" runat="server" Width="100%" AutoGenerateColumns="False"> <Behaviors> <ig:Paging Enabled="true" PageSize="20" PagerMode="NumericFirstLast" PagerAppearance="Top" FirstPageText="Primera" QuickPages="3"> </ig:Paging> <ig:Filtering> </ig:Filtering> </Behaviors> </ig:WebDataGrid>
Code behind:
private void GetResults() { //Culture info del cliente if (Request.UserLanguages.Count() > 0) System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(Request.UserLanguages[0]); DataSet ds = mServer.ExecuteQuery(q); Session["resultSet"] = ds.Tables[0]; for (int i = 0; i < ds.Tables[0].Columns.Count; i++) { var lField = new BoundDataField(); lField.DataType = "System.Single"; lField.DataFormatString = "{0:N}"; lField.DataFieldName = ds.Tables[0].Columns[i].ColumnName; lField.Key = ds.Tables[0].Columns[i].ColumnName; lField.Header.Text = ds.Tables[1].Rows[i].ItemArray[0].ToString(); grdResultados.Columns.Add(lField); } grdResultados.DataSource = ds.Tables[0]; grdResultados.DataBind(); grdResultados.Behaviors.Paging.PageIndex = 0; grdResultados.Behaviors.Paging.LastPageText = "Última(" + grdResultados.Behaviors.Paging.PageCount.ToString() + ")"; upResultados.Update(); }
But the grid shows like this:
Even when the culture Info is spanish.
Any clue?
Thanks in advance, regards
Hi,
Can you try something like the following:
<Columns>
<ig:BoundDataField DataFieldName="Age" Key="Age" DataFormatString="{0:N}" />
</Columns>
Hi,as you can see in code I've sent, the columns are dynamically created based on the resultset that hasn't the same columns each time, so I can't solve the problem in the way you suggest.
By the way, to do "lField.DataFormatString = "{0:N}";", is the same you suggest? Is what I found searching the web for a solution.
Regards