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

Grid is removing leading zeros from text field

1 Answer 167 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 20 Jan 2014, 08:11 AM
I have a Grid tat is displaying data.  I am providing a string that contains numbers, and the grid is removing leading zeros.  How can I alter this behavior?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Jan 2014, 09:52 AM
Hi Eric,

I'm not clear about your requirement i guess you have a string column with leading zero's that is not displaying. I couldn't find such an issue. Below is the sample code that i tried, please try and if this doesn't help, provide your code snippet.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" OnNeedDataSource="RadGrid1_NeedDataSource" >
    <MasterTableView DataKeyNames="ID" >   
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    dynamic data = new[] {
 new { ID = 1, Name = "Name1", Number=143},
 new { ID = 2, Name = "0Name2",Number=234},
 new { ID = 3, Name = "Name3", Number=234},
 new { ID = 4, Name = "Name4", Number=456},
 new { ID = 5, Name = "0Name5",Number=567},
 new { ID = 6, Name = "Name6", Number=567},
 new { ID = 7, Name = "Name7", Number=789},
 new { ID = 8, Name = "Name8", Number=896},
 new { ID = 9, Name = "0Name9",Number=741}
};
    RadGrid1.DataSource = data;
}

Thanks,
Shinu
Tags
Grid
Asked by
Eric
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or