Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
Duplicate keys and copy data when add new rows
posted

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}">

CssClass="NormalTextRight" 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!