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
175
WebDataGrid - user's new selection in dropdown shows on client but not server
posted

If the user selects a different item in the LocationTypeId dropdown and immediately clicks the test button, the call to alert() correctly shows the user's new selection, then the form is submitted. Immediately after that, on the server-side, if I examine the rows of the grid at the very first line of the Page_Load method, the value of that dropdown's column is still the old value, as if the user's new selection was never made. Why is that? Am I doing something wrong?

<iggrid:WebDataGrid id="grdISOGeneralLiabilityModel" runat="server"
AutoGenerateColumns="false"
EnableDataViewState="true"
>
<EditorProviders>
<iggrid:DropDownProvider ID="DropDownProviderForStateId">
<EditorControl ID="EditorControl4" runat="server" DisplayMode="DropDownList"</EditorControl>
</iggrid:DropDownProvider>
<iggrid:DropDownProvider ID="DropDownProviderForLocationTypeId">
<EditorControl ID="EditorControl5" runat="server" DisplayMode="DropDownList"></EditorControl>
</iggrid:DropDownProvider>
</EditorProviders>
<Columns>
<iggrid:BoundDataField DataFieldName="RatingGLId" key="RatingGLId" hidden="true"></iggrid:BoundDataField>
<iggrid:BoundDataField DataFieldName="StateId" key="StateId"></iggrid:BoundDataField>
<iggrid:BoundDataField DataFieldName="LocationTypeId" key="LocationTypeId"></iggrid:BoundDataField>
</Columns>
<Behaviors>
<iggrid:Selection CellClickAction="Row" RowSelectType="Single"></iggrid:Selection>
<iggrid:EditingCore AutoCRUD="false">
<Behaviors>
<iggrid:CellEditing>
<ColumnSettings>
<iggrid:EditingColumnSetting ColumnKey="StateId" EditorID="DropDownProviderForStateId" />
<iggrid:EditingColumnSetting ColumnKey="LocationTypeId" EditorID="DropDownProviderForLocationTypeId" />
</ColumnSettings>
<EditModeActions EnableOnActive="True" MouseClick="Single" />
</iggrid:CellEditing>
</Behaviors>
</iggrid:EditingCore>
</Behaviors>
</iggrid:WebDataGrid>

<input type="button" id="myTestButton" onclick="myTestButtonHandler()" value="Test" />

function myTestButtonHandler(sender, eventArgs) {
var grid = $find('<% = grdISOGeneralLiabilityModel.ClientID %>');
var selectedLocationType = grid.get_behaviors().get_selection().get_selectedRows(0).getItem(0).get_cellByColumnKey("LocationTypeId").get_value() + "=" +
grid.get_behaviors().get_selection().get_selectedRows(0).getItem(0).get_cellByColumnKey("LocationTypeId").get_text();
alert(selectedLocationType);
jQuery("[id$='aspnetForm']").submit();
}

Parents Reply Children