Hi,
I'm using WebDataGrid 11.1 and .Net 4.0.
Here my WebDataGrid is:
AutoGenerateColumns="False" rowheightdefault="20px" Font-Bold="False" DataKeyFields="ID" EnableDataViewState="True"> VisibleIndex="0"> Key="Package_Code" CssClass="NormalTextLeft">
CssClass="NormalTextLeft" DataFormatString="{0:dd/MM/yyyy}" DataType="System.DateTime">
DataFormatString="{0:N}">
EnableDropDownAsChild="False"> EnableDropDownAsChild="False" DropDownContainerWidth="200px"> EnableDropDownAsChild="False"> MinDecimalPlaces="0" MinValue="0" FocusOnInitialization="false" ViewStateMode="Enabled"> MinDecimalPlaces="2" MinValue="0" FocusOnInitialization="false" ViewStateMode="Enabled"> EditorID="UG_AnalysisAbNormal_DatePickerProvider1" /> EditorID="UG_AnalysisAbNormal_DropDownProvider1" /> EditorID="UG_AnalysisAbNormal_DropDownProvider2" /> EditorID="UG_AnalysisAbNormal_DropDownProvider3" /> EditorID="NumericEditorProvider" /> EditorID="UG_AnalysisAbNormal_NumericEditorProvider1" /> EditorID="UG_AnalysisAbNormal_NumericEditorProvider1" /> QuickPages="9" />
And here is my add new row code:(I'm using button)
function AddNewRow(GridName) { var grid = $find(GridName); var row = new Array(); for (var i = 0; i < grid.get_columns().get_length(); i++) { var column = grid.get_columns().get_column(i); switch (column._type) { case "number": if (column._key == "ID") row.push(-1 * grid.get_rows().get_length()); else row.push(null); break; case "boolean": row.push(false); break; default:
row.push(null); break; } }
grid.get_behaviors().get_activation().set_activeCell(null); grid.get_behaviors().get_selection().__clearAll(); grid.get_rows().add(row); return false; }
And my issue:
When I selected one row (or not) then ok.
But when my grid has one row, on the first time when i selected any cells are dropdowns and hit "Add" button then new row always copy data from row(0) and error occurs "Microsoft JScript runtime error: Exception thrown and not caught".
How i can solved this issue?
Thanks & regards!
Hi Olga!
Thanks for your reply. I'm disabled Ajax and used <ig:EditingCore BatchUpdating="true">, issue was solved.
The value for your ID field needs to be unique, since that is your PrimaryKey. I suggest creating a global variable in the javascript and setting it to -1, use that variable as your ID value for the new row you are creating and then decrement it by 1 after you have used it.
Thanks
Olga