Hi,
I'm trying to insert/update values in an XML file using XMLDataSource and RadGrid. Below is my code :
aspx
aspx.vb
output:
Field Name : concat_substring_start_pos , Value : 7
Field Name : concat_constant_value , Value : 6
Field Name : seq_no , Value : 3
Field Name : list_code , Value : BA002
Field Name : ruleset_id , Value : 1
Field Name : concat_substring_end_pos , Value : 8
Field Name : new_field_name , Value : 4
I'm encountering 2 issues :
1. Column 5 (field_name), which is a template column that uses RadComboBox for editing and is bound to another data source for fetching values, is not extracted into the Hashtable.
2. Values in the hashtable are not in ordered in the sequence of RadGrid columns.
Please suggest the solutions for these (Issue 1 is higher priority)
Thanks,
Nishant
I'm trying to insert/update values in an XML file using XMLDataSource and RadGrid. Below is my code :
aspx
<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" DataSourceID="XmlDataSource1" GridLines="None"> <MasterTableView AutoGenerateColumns="False" DataSourceID="XmlDataSource1" EditMode="InPlace" CommandItemDisplay="Bottom" InsertItemDisplay="Bottom"> <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings> <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"> </RowIndicatorColumn> <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"> </ExpandCollapseColumn> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"> <ItemStyle CssClass="MyImageButton" /> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="ruleset_id" FilterControlAltText="Filter ruleset_id column" HeaderText="ruleset_id" SortExpression="ruleset_id" UniqueName="ruleset_id"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn DataField="list_code" FilterControlAltText="Filter list_code column" HeaderText="list_code" SortExpression="list_code" UniqueName="list_code"> <EditItemTemplate> <telerik:RadComboBox ID="ListCodeComboBox" runat="server" SelectedValue='<%# Bind("list_code") %>'> <Items> <telerik:RadComboBoxItem Text="BA001" Value="BA001" /> <telerik:RadComboBoxItem Text="BA002" Value="BA002" /> <telerik:RadComboBoxItem Text="BA003" Value="BA003" /> </Items> </telerik:RadComboBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="list_codeLabel" runat="server" Text='<%# Eval("list_code") %>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="seq_no" FilterControlAltText="Filter seq_no column" HeaderText="seq_no" SortExpression="seq_no" UniqueName="seq_no"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="new_field_name" FilterControlAltText="Filter new_field_name column" HeaderText="new_field_name" SortExpression="new_field_name" UniqueName="new_field_name"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn DataField="field_name" FilterControlAltText="Filter field_name column" HeaderText="Field Name" SortExpression="field_name" UniqueName="field_name"> <EditItemTemplate> <telerik:RadComboBox ID="FieldNameComboBox" runat="server" DataSourceID="XmlDataSource2" DataTextField="field_name" DataValueField="field_length" AppendDataBoundItems="True"> <Items> <telerik:RadComboBoxItem Text="Select" Value="" /> </Items> </telerik:RadComboBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="field_nameLabel" runat="server" Text='<%# Eval("field_name") %>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="concat_constant_value" FilterControlAltText="Filter concat_constant_value column" HeaderText="concat_constant_value" SortExpression="concat_constant_value" UniqueName="concat_constant_value"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="concat_substring_start_pos" FilterControlAltText="Filter concat_substring_start_pos column" HeaderText="concat_substring_start_pos" SortExpression="concat_substring_start_pos" UniqueName="concat_substring_start_pos"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="concat_substring_end_pos" FilterControlAltText="Filter concat_substring_end_pos column" HeaderText="concat_substring_end_pos" SortExpression="concat_substring_end_pos" UniqueName="concat_substring_end_pos"> </telerik:GridBoundColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"> </EditColumn> </EditFormSettings> </MasterTableView> </telerik:RadGrid> <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="C:\TEMP\CONCATENATION_DETAIL_TEMP.XML"> </asp:XmlDataSource> <asp:XmlDataSource ID="XmlDataSource2" runat="server" DataFile="C:\TEMP\LAYOUT_FIELDS_TABLE.XML" TransformFile="C:\TEMP\LAYOUT_FIELDS_TABLE.XSL"></asp:XmlDataSource>aspx.vb
Private Sub RadGrid1_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand Dim ht As Hashtable = New Hashtable() DirectCast(e.Item, GridDataInsertItem).ExtractValues(ht) Dim s As String = "" For Each entry In ht s = s + "Field Name : " + entry.Key.ToString() + " , Value : " + entry.Value + vbCrLf Next MsgBox(s)End Suboutput:
Field Name : concat_substring_start_pos , Value : 7
Field Name : concat_constant_value , Value : 6
Field Name : seq_no , Value : 3
Field Name : list_code , Value : BA002
Field Name : ruleset_id , Value : 1
Field Name : concat_substring_end_pos , Value : 8
Field Name : new_field_name , Value : 4
1. Column 5 (field_name), which is a template column that uses RadComboBox for editing and is bound to another data source for fetching values, is not extracted into the Hashtable.
2. Values in the hashtable are not in ordered in the sequence of RadGrid columns.
Please suggest the solutions for these (Issue 1 is higher priority)
Thanks,
Nishant
