I am updating from the frid to an XML file. The first column is a dropdown list. I copied this code directly from one of the online demos. For some or other reason it is not passing the value of the value of the selected drop down list. It is the element called StoreLocatorID.
protected void rgDeposits_UpdateCommand(object source, GridCommandEventArgs e)
{
GridEditFormItem gridEditFormItem = (GridEditFormItem)e.Item;
Hashtable ht = new Hashtable();
gridEditFormItem.ExtractValues(ht);
String _DepositID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["DepositID"].ToString();
XmlNode node = dsDeposits.GetXmlDocument().SelectSingleNode(String.Format("Deposits/Deposit[@DepositID='{0}']", _DepositID));
node.Attributes["StoreLocatorID"].Value = ConvertNullToEmpty(ht["StoreLocatorID"]);
node.Attributes["CurrentAccountNumber"].Value = ConvertNullToEmpty(ht["CurrentAccountNumber"]);
node.Attributes["BranchNo"].Value = ConvertNullToEmpty(ht["BranchNo"]);
node.Attributes["ClientCITNo"].Value = ConvertNullToEmpty(ht["ClientCITNo"]);
node.Attributes["DateOfDeposit"].Value = ConvertNullToEmpty(ht["DateOfDeposit"]);
node.Attributes["DepositReferenceInput"].Value = ConvertNullToEmpty(ht["DepositReferenceInput"]);
node.Attributes["DepositAmount"].Value = ConvertNullToEmpty(ht["DepositAmount"]);
try
{
dsDeposits.Save();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
private String ConvertNullToEmpty(Object obj)
{
if (obj == null)
{
return String.Empty;
}
else
{
return obj.ToString();
}
}
Please can someone help me?
Thanks
Brendan