Welcome Guest Search | Active Topics | Sign In | Register

eo.web grid - editing issues... Options
grchen168
Posted: Friday, November 8, 2024 9:45:26 AM
Rank: Advanced Member
Groups: Member

Joined: 8/26/2021
Posts: 47
Based on the grid editing demo (Grid->Features->Edit Grid Data->Excel Style ) installed with v24.2.81, I encounter the following issues:

(1) In the code behind after postback, it demonstrates how to retrieve changed items via ChangedItems property.
Question is: other than the new value, is there any (build-in property?) way to get the old value of the changed item's cell ??
Hope that we don't need to look up in the data source for the cell's old value.

(2) In the grid, if I click the editable cell (that is, put the cell into edit mode) and do nothing (that is, make no change), just leave the cell.
Why, in the postbak, the cell's Modified property is True?

(3) Using the grid markup in the demo aspx, it had already specified KeyField="TopicID".
Because I don't want to use data binding, so I add the corresponding Column named "TopicID" definition into the <Columns> section:
<eo:RowNumberColumn Width="40"></eo:RowNumberColumn>
<eo:TextBoxColumn HeaderText="TopicID" DataField="TopicID" ></eo:TextBoxColumn>
<eo:DateTimeColumn HeaderText="Posted At" DataField="PostedAt"></eo:DateTimeColumn>
<eo:TextBoxColumn HeaderText="Posted By" DataField="PostedBy"></eo:TextBoxColumn>
<eo:TextBoxColumn Width="300" HeaderText="Topic" DataField="Topic"></eo:TextBoxColumn>

And, then I use the following code to populate testing data to the grid:
for(int i=1;i<=10;++i)
{
GridItem gi;
gi=Grid1.CreateItem();
gi.Cells["TopicID"].Value=i.ToString();
gi.Cells["PostedAt"].Value="";
gi.Cells["PostedBy"].Value=i.ToString();
gi.Cells["Topic"].Value=i.ToString();
Grid1.Items.Add(gi);
}

At runtime, making some editings for the Topic or PostedBy cells' value.

Question is, why, in the postback, the changeditem's Key value is ''? (not the expected actual TopicID value for the item)

eo_support
Posted: Tuesday, November 12, 2024 10:20:15 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

As to your question:

1. Unfortunately no, the old value is overwritten and not kept. This is also one of the main purpose of KeyField -- so that you can look up the old value if you must. Another way to keep the old value is to use an invisible column. So basically you will have two columns bound to the same data field --- one column's sole purpose is to keep the old value, where as the other column is for editing;

2. This is correct. We do not compare old value with new value. As long as user entered edit mode and submitted the result, the cell is marked as modified;

3. The Key value is strictly tied to KeyField and data binding and it does not have anything to do with any column. Since data binding is not used, Key value will not be populated;

Please feel free to let us know if you have any more questions.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.