I have a grid where on the ItemDataBound event, Im using some custom checking on the columns based on a list of objects from my database to see if the column can be edited or not. For the ones that can be edited, I then created a RegularExpressionValidator for the table cell along with setting the maxlength of the textbox when its in edit mode. This works perfectly until when I go to update the record. The way Im doing it is to grab the edited cell, build a gridRow and then remove that currently selected GridRow (the one being edited) and insert the new one using the new values from the edited row.
Here is my regular expression building
I get this values by during my grid_UpdateCommand event and call
The row Im dealing with is working weird because during this call, the 2 columns textboxes that arent enabled (think like ReadOnly but the user can still see the values) are getting the new record values fine, but the 2 user editable textboxes are pulling back a null. When I turn the regular expression building off (comment it out), it pulls the records perfectly with all the column values. But when I have the regular expression building and checking on, it cant pull these values? Any reason why?
Here is my regular expression building
GridEditableItem item = e.Item as GridEditableItem;//this is within a loop for the columns and another loop for my custom objects (metaData)//set edit textbox max lengthitem[column.UniqueName].Enabled = true;TextBox txtbx = (TextBox)item[column.UniqueName].Controls[0];txtbx.MaxLength = metaData.MaxFieldLength;//set regular expression for validationRegularExpressionValidator regex = new RegularExpressionValidator();GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)item.EditManager.GetColumnEditor(column.UniqueName);TableCell cell = (TableCell)editor.TextBoxControl.Parent;editor.TextBoxControl.ID = "Validation" + column.UniqueName;regex.Display = ValidatorDisplay.Dynamic;regex.ControlToValidate = editor.TextBoxControl.ID;regex.ForeColor = System.Drawing.Color.Red;regex.ValidationExpression = @"^";//custom regex expression buildingregex.ValidationExpression = regex.ValidationExpression + @"$";cell.Controls.Add(regex);I get this values by during my grid_UpdateCommand event and call
//get selected rowGridEditableItem item = (GridEditableItem)e.Item;//get values from the rowHashtable newValues = new Hashtable();e.Item.OwnerTableView.ExtractValuesFromItem(newValues, item);The row Im dealing with is working weird because during this call, the 2 columns textboxes that arent enabled (think like ReadOnly but the user can still see the values) are getting the new record values fine, but the 2 user editable textboxes are pulling back a null. When I turn the regular expression building off (comment it out), it pulls the records perfectly with all the column values. But when I have the regular expression building and checking on, it cant pull these values? Any reason why?