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

Dynamic columns remove groupseparator

1 Answer 20 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vishal
Top achievements
Rank 1
Vishal asked on 22 Jul 2014, 04:33 PM
Hi All,

I have created grid with Auto Generate Columns at runtime and have problem in edit mode. We have column with integer value and dont want to display "," while in edit mode.

Read              Edit mode
100001 ----> 100,001

Is there any way that I can set all columns to textbox with no numeric settings? Basically I want to display text in RadTextBox and not RadNumericTextBox.

FYI, I am developing in ASP.Net and VB.Net.

Thanks, Vishal

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 23 Jul 2014, 05:52 AM
Hi Vishal,

When you set the AutoGenerateColumns property of RadGrid to true, the RadGrid control generates a separate column for each data field in the control's assigned datasource.
Based on the datatype of the field, the control will generate:
-GridBoundColumn for string fields
-GridCheckBoxColumn for boolean fields
-GridDateTimeColumn for datetime fields
-GridNumericColumn for numeric fields
    Hence for numeric fields, it will have a RadNumericTextBox in edit mode.
In order to avoid the Group Separator, you can try the following code snippet.

VB:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
        Dim edit As GridEditableItem = DirectCast(e.Item, GridEditableItem)
        Dim rnumtxtColumn As RadNumericTextBox = DirectCast(edit("DataFieldName").Controls(0), RadNumericTextBox)
        rnumtxtColumn.NumberFormat.GroupSeparator = ""
    End If
End Sub

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