How do I set the format for the drop-down list of the GridFilterBar's DateTime column in the GDBG?
After wiring the grid, you can explicitly adjust the FilterBar's droplists. The attached sample changes the FilterBar's droplist date-time format.
C#
/Wire the GridFilterBar
GridFilterBar filter = new GridFilterBar();
filter.WireGrid(this.gridDataBoundGrid1);
//change the dateformats for the GridFilterBar dropdown
int col = this.gridDataBoundGrid1.Binder.NameToColIndex("Col1");
if(col > -1)
{
DataTable dt1 = (DataTable) this.gridDataBoundGrid1[1, col].DataSource;
for(int i = 2; i <dt1.Rows.Count; ++i)
dt1.Rows[i][0] = DateTime.Parse((string) dt1.Rows[i][0]).ToShortDateString();
}
}
VB
Wire the GridFilterBar
Dim filter As New GridFilterBar()
filter.WireGrid(Me.gridDataBoundGrid1)
'change the dateformats for the GridFilterBar dropdown
Dim col As Integer = Me.gridDataBoundGrid1.Binder.NameToColIndex("Col1")
If col > - 1 Then
Dim dt1 As DataTable = CType(Me.gridDataBoundGrid1(1, col).DataSource, DataTable)
Dim j As Integer
For j = 2 To dt1.Rows.Count - 1
dt1.Rows(j)(0) = DateTime.Parse(CType(dt1.Rows(j)(0), String)).ToShortDateString()
Next
End If
Here is the link with both CS and VB samples: http://websamples.syncfusion.com/samples/KB/Grid.Windows/GDBGFormatFilter/main.htm