Hi ,
I have a column START DATE in grid which must contain web date chosser for allowing user to select a date.
Can any one tell me how to add date chooser to all row of grid.
Have you looked at using a templated column?
Please send code for that
I don't use templated columns, so I don't have code for that, but here's what I would do if I needed to:
You can look at the sample here: http://samples.infragistics.com/2007.3/webfeaturebrowser/default.htm
Under grid there are two samples using datechooser.
Hi, I added a WebDateChooser in the form. In the InitializeLayout of the grid I do:
col = gOpenRequests.Columns.FromKey(columnName)
col.Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom
col.EditorControlID = WebDateChooser1.UniqueID
col.DataType = "System.DateTime"
WebDateChooser1.Format = Infragistics.WebUI.WebSchedule.DateFormat.Short
col.Format = cnstShortDate '"yyyy-MM-dd"
Note: I have to do this when the data is refresehd too.
To save the data with the update method I added these lines because the internal value of the web date chooser control includes #'s:
Dim DataKey As Object
' Get the correct table from the dataset based on the table name that is bound to
' the grid
DataKey = e.Cell.Row.Cells.FromKey(dt.PrimaryKey(0).ColumnName).Value
Dim dr As DataRow = Nothing
' If we have the DataKey then go get the correct row from the DataTable
If (Not (DataKey Is Nothing)) Then
dr = dt.Rows.Find(DataKey)
End If
'if the value is a date, the value is #yyyy-MM-dd#
If e.Cell.Column.DataType = "System.DateTime" And Not CellVal Is Nothing Then
CellVal = CDate(CellVal).ToString(cnstShortDate) 'Left(CellVal.ToString, 10)
' Update the correct field of the DataRow to the Cell Value
dr(e.Cell.Column.Key) = CellVal
Regards,
Fernando