Hi,
I have 2 problems. They may be related.
First, when I change the value of the dropdown list in the RowEditTemplate, the field is not read. When you view the updated record, the dropdown list is always blank. All of the other fields are text fields and are saved properly. I tried using an EditorProvider but it would not work. The values from the datasource would not display.
The second problem is that after the update a postback should occur refreshing all of the fields. I have one field that is a concatenation of 3 fields and it is displayed as the 'Name'. This field should update also after the record has been changed. If you access the editor template a second time and click 'OK' the 'Name' is correctly updated.
This is my markup file. I will display the entire thing and it is large:
<ig:WebHierarchicalDataGrid runat="server" height="600px" width="875px" ClientIDMode="Static" AutoGenerateBands="False" AutoGenerateColumns="False" DataKeyFields="ID" DataMember="SqlDataSource1_DefaultView" StyleSetName="Windows7" ID="wdgOffice" DataSourceID="WebHierarchicalDataSource1" Key="SqlDataSource1_DefaultView" > <Columns> <ig:BoundDataField DataFieldName="ID" Key="ID" Hidden="true"> <Header Text="ID" /> <header text="ID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="AddressPrefix" Key="AddressPrefix" Hidden="true"> <Header Text="AddressPrefix" /> <header text="AddressPrefix" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Address" Key="Address" Hidden="true"> <Header Text="Address" /> <header text="Address" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="AddressSuffix" Key="AddressSuffix" Hidden="true"> <Header Text="AddressSuffix" /> <header text="AddressSuffix" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="City" Key="City" Hidden="true"> <Header Text="City" /> <header text="City" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="CityMailing" Key="CityMailing" Hidden="true"> <Header Text="CityMailing" /> <header text="CityMailing" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="State" Key="State" Hidden="true"> <Header Text="State" /> <header text="State" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Zip" Key="Zip" Hidden="true"> <Header Text="Zip" /> <header text="Zip" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="CountyName" Key="CountyID" Hidden="true"> <Header Text="CountyID" /> <header text="CountyID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Lat" Key="Lat" Hidden="true"> <Header Text="Lat" /> <header text="Lat" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Long" Key="Long" Hidden="true"> <Header Text="Long" /> <header text="Long" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Name" Key="Name" Width="95%"> <Header Text="Name" /> <header text="Name" /> </ig:BoundDataField> </Columns> <Behaviors> <ig:Selection CellClickAction="Row" RowSelectType="Single"></ig:Selection> <ig:RowSelectors></ig:RowSelectors> <ig:EditingCore> <EditingClientEvents RowsDeleting="wdgOffice_Editing_RowsDeleting" /> <Behaviors> <ig:RowEditingTemplate CancelButton="buttonCancel" OKButton="buttonOK"> <ClientBindings> <ig:RowEditingClientBinding ColumnKey="ID" ControlID="OfficeID" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="AddressPrefix" ControlID="txtAddressPrefix" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="Address" ControlID="txtAddress" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="AddressSuffix" ControlID="txtAddressSuffix" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="City" ControlID="txtCity" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="CityMailing" ControlID="txtCityMailing" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="State" ControlID="txtState" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="Zip" ControlID="txtZip" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="CountyID" ControlID="ddlCounty" GetValueJavaScript="$find({ClientID}).get_currentValue()" SetValueJavaScript="$find({ClientID}).set_currentValue({value},true)" /> <ig:RowEditingClientBinding ColumnKey="Lat" ControlID="txtLat" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> <ig:RowEditingClientBinding ColumnKey="Long" ControlID="txtLong" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> </ClientBindings> <Template> <table id="tblEdit" style="width: 800px; border: 1px solid Black; background-color:White;"> <tr> <td align="left" style="width: 15%;"> <asp:HiddenField ID="OfficeID" runat="server" /> <asp:Label ID="lblAddressPrefix" runat="server" Text="Address Prefix: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtAddressPrefix" runat="server" Width="200px" /> </td> <td align="left" style="width: 15%;"> <asp:Label ID="lblAddress" runat="server" Text="Address: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtAddress" runat="server" Width="200px" /> </td> </tr> <tr> <td align="left" style="width: 15%;"> <asp:Label ID="lblAddressSuffix" runat="server" Text="Address Suffix: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtAddressSuffix" runat="server" Width="200px" /> </td> <td align="left" style="width: 15%;"> <asp:Label ID="lblCity" runat="server" Text="City: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtCity" runat="server" Width="200px" /> </td> </tr> <tr> <td align="left" style="width: 15%;"> <asp:Label ID="lblCityMailing" runat="server" Text="City Mailing: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtCityMailing" runat="server" Width="200px" /> </td> <td align="left" style="width: 15%;"> <asp:Label ID="lblState" runat="server" Text="State: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtState" runat="server" Width="200px" /> </td> </tr> <tr> <td align="left" style="width: 15%;"> <asp:Label ID="lblZip" runat="server" Text="Zip Code: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtZip" runat="server" Width="200px" /> </td> <td align="left" style="width: 15%;"> <asp:Label ID="lblCounty" runat="server" Text="County: " /> </td> <td align="left" style="width: 35%;"> <ig:WebDropDown ID="ddlCounty" runat="server" Width="200px" TextField="CountyName" ValueField="CountyID" DataSourceID="SqlDataSource3" EnableDropDownAsChild="true" ClientEvents-Initialize="setZIndex" DropDownItemBinding-TextField="Name" DropDownItemBinding-ValueField="ID"/> </td> </tr> <tr> <td align="left" style="width: 15%;"> <asp:Label ID="lblLat" runat="server" Text="Latitude: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtLat" runat="server" Width="200px" /> <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" MaskType="Number" TargetControlID="txtLat" Mask="99.999999999" AcceptNegative="Left"> </asp:MaskedEditExtender> </td> <td align="left" style="width: 15%;"> <asp:Label ID="lblLong" runat="server" Text="Longitude: " /> </td> <td align="left" style="width: 35%;"> <asp:TextBox ID="txtLong" runat="server" Width="200px" /> <asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" MaskType="Number" TargetControlID="txtLong" Mask="99.999999999" AcceptNegative="Left"> </asp:MaskedEditExtender> </td> </tr> <tr> <td></td> <td></td> <td></td> <td align="right"> <asp:Button ID="buttonOK" runat="server" OnClientClick="return" Text="OK" UseSubmitBehavior="False" /> <asp:Button ID="buttonCancel" runat="server" CausesValidation="False" OnClientClick="return" Text="Cancel" UseSubmitBehavior="False" /> </td> </tr> </table> </Template> </ig:RowEditingTemplate> <ig:RowDeleting /> </Behaviors> </ig:EditingCore> </Behaviors> </ig:WebHierarchicalDataGrid> </ContentTemplate> </asp:UpdatePanel> <ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server"> <DataViews> <ig:DataView ID="SqlDataSource1_DefaultView" DataMember="DefaultView" DataSourceID="SqlDataSource1" /> </DataViews> </ig:WebHierarchicalDataSource> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ not showing the connection string %>" SelectCommand="GetOffices" SelectCommandType="StoredProcedure" UpdateCommand="SetOffices" UpdateCommandType="StoredProcedure" InsertCommand="InsOffices" InsertCommandType="StoredProcedure" DeleteCommand="DelOffices" DeleteCommandType="StoredProcedure"> <UpdateParameters> <asp:Parameter Name="ID" Type="Int32" /> <asp:Parameter Name="AddressPrefix" Type="String" ConvertEmptyStringToNull="false" /> <asp:Parameter Name="Address" Type="String" ConvertEmptyStringToNull="false" /> <asp:Parameter Name="AddressSuffix" Type="String" ConvertEmptyStringToNull="false" /> <asp:Parameter Name="City" Type="String" ConvertEmptyStringToNull="false" /> <asp:Parameter Name="CityMailing" Type="String" ConvertEmptyStringToNull="false" /> <asp:Parameter Name="State" Type="String" ConvertEmptyStringToNull="false" /> <asp:Parameter Name="Zip" Type="String" ConvertEmptyStringToNull="false" /> <asp:ControlParameter Name="CountyID" ControlID="ddlCounty" PropertyName="SelectedValue" Type="Int32"/> <asp:Parameter Name="CountyName" Type="String" /> <asp:Parameter Name="Lat" Type="Decimal" DefaultValue="" ConvertEmptyStringToNull="true" /> <asp:Parameter Name="Long" Type="Decimal" DefaultValue="" ConvertEmptyStringToNull="true" /> <asp:Parameter Name="Name" Type="String" /> </UpdateParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ not showing %>" SelectCommand="GetCounty" SelectCommandType="StoredProcedure"> </asp:SqlDataSource>
Why doesn't the Selected Value of the dropdown get saved to the database?
After the update occurs, how can I force a postback so the data is updated in all fields including a derived field?
Thanks.
I am glad to hear that,
Thank you for using our controls!
No I have resolved these issues.
Hello,I am just checking, if you require any further assistance on the matter.
Hello,
Thank you for contacting us!
About your question, it is possible to use WebDropDown with RET, although you should handle TemplateClosed event in order to change the edited cell value. In the sample that I have created for you I have only one cell and this is why I am performing the cell.set_value and text to only one cell.
AutoCrud is set to True in order the Grid to handle automatically the update statement.
As you will see, after I change the Value from the DropDown, it is updating the cell also.
Let me know if I may be of further assistance, I hope that you will benefit from the sample.