I have a simple RadGrid bound to a business object. When I Add or Edit with the Automatic PopUp, I can not get the new / updated value from the PopUp window.
The Grid is setup with the following:
I am binding to a simple business object with the following code:
When I click on Edit for one of the values, I am able to change the existing value for the description, but both methods for retrieving the new value in the code below return the old value:
Any ideas?
The Grid is setup with the following:
| <telerik:RadGrid ID="LocationGrid" runat="server" Skin="Web20" OnDeleteCommand="OnLocationDelete" |
| OnInsertCommand="OnLocationInsert" OnItemDeleted="OnLocationItemDeleted" OnItemInserted="OnLocationItemInserted" |
| OnItemUpdated="OnLocationItemUpdated" OnNeedDataSource="OnNeedDataSource" |
| OnUpdateCommand="OnLocationUpdate" ShowStatusBar="True" |
| AutoGenerateColumns="False" GridLines="None" onitemcommand="OnItemCommand"> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <MasterTableView EditMode="PopUp" CommandItemDisplay="Top"> |
| <Columns> |
| <telerik:GridBoundColumn DataField="ID" UniqueName="colID" Visible="false" DataType="System.Int32"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Description" UniqueName="colDescription" HeaderText="Description"> |
| </telerik:GridBoundColumn> |
| <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="colDelete" HeaderText="Delete"> |
| </telerik:GridButtonColumn> |
| <telerik:GridButtonColumn CommandName="Edit" Text="Edit" UniqueName="colEdit" HeaderText="Edit"> |
| </telerik:GridButtonColumn> |
| </Columns> |
| <EditFormSettings CaptionFormatString="Edit Location" /> |
| </MasterTableView> |
| </telerik:RadGrid> |
I am binding to a simple business object with the following code:
| private List<Location> LocationList |
| { |
| get |
| { |
| return Session["LocationList"] as List<Location>; |
| } |
| set |
| { |
| Session["LocationList"] = value; |
| } |
| } |
| private void BuildInitialList() |
| { |
| LocationList = new List<Location> |
| { |
| new Location() {ID = 1, Description = "Some Location"}, |
| new Location() {ID = 2, Description = "Some Other Location"}, |
| }; |
| } |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| if (!Page.IsPostBack) |
| BuildInitialList(); |
| LocationGrid.DataSource = LocationList; |
| LocationGrid.DataBind(); |
| } |
When I click on Edit for one of the values, I am able to change the existing value for the description, but both methods for retrieving the new value in the code below return the old value:
| protected void OnLocationUpdate(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| GridEditableItem item = e.Item as GridEditableItem; |
| // Description is the old value |
| string Description = (item["colDescription"].Controls[0] as TextBox).Text; |
| // values["Description"] is the old value |
| Dictionary<string, string> values = new Dictionary<string, string>(); |
| item.ExtractValues(values); |
| } |
Any ideas?