I am using RadGrid and trying to implement "Update All" feature.
I explicitly pass in null, but save as '01/01/1900/ to database table.
protected void rgJobInv_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == "UpdateAll")
{
foreach (Telerik.Web.UI.GridEditableItem editedItem in rgJobInv.EditItems)
{
Hashtable newValues = new Hashtable();
e.Item.OwnerTableView.RetrieveNullAsDBNull = true;
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
sdsUpdateAll.UpdateCommand =
string.Format("update tblJobInventory set District='{0}', ......" +
", Shipped = '{15}' " +
", Billed = '{16}' ....."
, newValues[
"District"].....
,null /*newValues["Shipped"]*/
, null /* newValues["Billed"]*/
In database table, "Shipped" and "Billed" is smalldatetime type.
I pass in null, but both "Shipped" and Billed are saved as '01/01/1900'.
even when I pass newValues["Shipped"], which is null, but still it was saved
as '01/01/1900'.
Please give some ideas.
thanks.
Stanley Huang