Hello,
I have a Grid now that is updated once a day with changes on various status' from my users. My question is, does anyone have any ideas on how to save those previous entries to an archive that the user can go into and view previous entries?
The goal would be to have this archive and then after a certain point those archived entries would be deleted to avoid taking up too much database room unnecessarily.
Right now here is how I am saving my grid to my database, I just wasn't sure on how to expand on this to get that additional functionality.
I have a Grid now that is updated once a day with changes on various status' from my users. My question is, does anyone have any ideas on how to save those previous entries to an archive that the user can go into and view previous entries?
The goal would be to have this archive and then after a certain point those archived entries would be deleted to avoid taking up too much database room unnecessarily.
Right now here is how I am saving my grid to my database, I just wasn't sure on how to expand on this to get that additional functionality.
private
void
SaveDataInDataTable()
{
foreach
(GridDataItem item
in
RadGrid1.MasterTableView.Items)
{
if
(item.IsInEditMode)
{
int
rowID = (
int
)item.GetDataKeyValue(
"ID"
);
for
(
int
i = 2; i < RadGrid1.MasterTableView.RenderColumns.Length; i++)
{
GridColumn column = RadGrid1.MasterTableView.RenderColumns[i];
DataRow myDataRow = GridSource.Select(
"ID = "
+ rowID)[0];
object
value = GetColumnValue(column, item);
if
(column.DataType ==
typeof
(
int
))
{
if
(value ==
string
.Empty || value ==
null
)
{
myDataRow[column.UniqueName] = DBNull.Value;
}
else
{
int
parsedValue;
if
(
int
.TryParse(value.ToString(),
out
parsedValue))
{
myDataRow[column.UniqueName] = parsedValue;
}
else
{
myDataRow[column.UniqueName] = myDataRow[column.UniqueName];
RadAjaxManager1.Alert(
string
.Format(
"Value {0} is not valid for column {1}, row {2}. The old value was used!"
, value, column.UniqueName, item.ItemIndex+1));
}
}
}
else
if
(value ==
null
)
{
myDataRow[column.UniqueName] = DBNull.Value;
}
else
if
((GridSource.Columns[column.UniqueName].MaxLength < value.ToString().Length) && GridSource.Columns[column.UniqueName].MaxLength != -1)
{
myDataRow[column.UniqueName] = value.ToString().Substring(0, 5);
}
else
{
myDataRow[column.UniqueName] = GetColumnValue(column, item);
}
}
}