J
Jeff Petter
I can't seem to get the update piece working properly while doing in-place editing. I don't receive any errors, but the update doesn't take place. From the examples I've used as "go bys" it looks pretty straight forward. I've included my update code below. If anyone has any insight into my problem, I would certainly appreciate it.
Thanks,
Jeff
private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
//load the dataset with the xml file
ds = new DataSet();
//load string with full path to xml file
string strFile = Server.MapPath(Request.ApplicationPath) + "\\exceptions.xml";
//load the dataset with the xml file
ds.ReadXml (strFile, XmlReadMode.InferSchema);
string strDate = ((TextBox)(e.Item.Cells[2].Controls[0])).Text;
string strException = ((TextBox)(e.Item.Cells[3].Controls[0])).Text;
string strDuration = ((TextBox)(e.Item.Cells[4].Controls[0])).Text;
//get current row
DataRow dr = ds.Tables["exceptions"].Rows[e.Item.ItemIndex];
dr["eDate"] = strDate;
dr["exception"] = strException;
dr["duration"] = strDuration;
ds.Tables["exceptions"].AcceptChanges();
ds.WriteXml (Server.MapPath(Request.ApplicationPath) + "\\exceptions.xml");
DataGrid1.EditItemIndex = -1;
BindDataGrid();
}
Thanks,
Jeff
private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
//load the dataset with the xml file
ds = new DataSet();
//load string with full path to xml file
string strFile = Server.MapPath(Request.ApplicationPath) + "\\exceptions.xml";
//load the dataset with the xml file
ds.ReadXml (strFile, XmlReadMode.InferSchema);
string strDate = ((TextBox)(e.Item.Cells[2].Controls[0])).Text;
string strException = ((TextBox)(e.Item.Cells[3].Controls[0])).Text;
string strDuration = ((TextBox)(e.Item.Cells[4].Controls[0])).Text;
//get current row
DataRow dr = ds.Tables["exceptions"].Rows[e.Item.ItemIndex];
dr["eDate"] = strDate;
dr["exception"] = strException;
dr["duration"] = strDuration;
ds.Tables["exceptions"].AcceptChanges();
ds.WriteXml (Server.MapPath(Request.ApplicationPath) + "\\exceptions.xml");
DataGrid1.EditItemIndex = -1;
BindDataGrid();
}