Hello,
I have an autogenerated edit form, I'm trying to get the data from the controls on the edit form as follows, but the data in the controls is the un-editted value. This is how all the examples show this working. Any ideas?
Thanks!
I have an autogenerated edit form, I'm trying to get the data from the controls on the edit form as follows, but the data in the controls is the un-editted value. This is how all the examples show this working. Any ideas?
Thanks!
#region gvLUs_UpdateCommand event
protected void gvLUs_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
//Get the GridEditableItem of the RadGrid
GridEditableItem editedItem = e.Item as GridEditableItem;
// Build our Update string
string strUpdate = "";
string strWhere = "";
int ic = 0;
GridColumn editColumn;
for (int i=0; i<gvLUs.MasterTableView.AutoGeneratedColumns.Count(); i++)
{
ic++;
if (i == 0)
{
// Get our PK column
editColumn = gvLUs.MasterTableView.AutoGeneratedColumns[i];
LU.ID = editColumn.UniqueName.ToString();
LU.IDValue = Convert.ToInt32((editedItem[editColumn].Controls[0] as TextBox).Text);
// Add to our UPDATE string
strUpdate = "UPDATE " + LU.TableName + " SET ";
strWhere = " WHERE " + LU.ID + " = " + LU.IDValue.ToString();
}
else
{
if (ic != gvLUs.MasterTableView.AutoGeneratedColumns.Count())
{
// Get other values to be updated
editColumn = gvLUs.MasterTableView.AutoGeneratedColumns[i];
strUpdate += editColumn.UniqueName.ToString() + " = '" + (editedItem[editColumn.UniqueName].Controls[0] as TextBox).Text + "' ,";
}
else
{
// Get other values to be updated
editColumn = gvLUs.MasterTableView.AutoGeneratedColumns[i];
strUpdate += editColumn.UniqueName.ToString() + " = '" + (editedItem[editColumn.UniqueName].Controls[0] as TextBox).Text + "'";
}
}
}