This is a migrated thread and some comments may be shown as answers.

RadGrid inside a RadListView issues?

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 07 May 2015, 07:57 AM

Hi,

 

I've got a radgrid inside the item template of a radlistview and everything binds fine and looks ok with the data, however when i try and perform an edit on the data inside the radgrid then things dont seem to be working correctly.

I have set a OnUpdateCommand function for the grid but it is seemingly never called, i also have an onItemCommand function which i can successfully use to intercept the 'Update' commandname, however when i try and get any column values i simply get either "" or "&nbsp" back instead.

 

<telerik:RadGrid ID="radgrvAffectedLocations" runat="server" MasterTableView-EditMode="InPlace" OnNeedDataSource="radgrvAffectedLocations_NeedDataSource" OnItemDataBound="radgrvAffectedLocations_ItemDataBound" OnUpdateCommand="radgrvAffectedLocations_UpdateCommand"  OnItemCommand="radgrvAffectedLocations_ItemCommand">
                                   <MasterTableView AutoGenerateColumns="False" TableLayout="Fixed">
                                       <Columns>
                                           <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
                                          <telerik:GridBoundColumn DataField="ID" UniqueName="ID" ></telerik:GridBoundColumn>
                                           <telerik:GridBoundColumn DataField="ServiceID" UniqueName="ServiceID"></telerik:GridBoundColumn>
                                          <telerik:GridTemplateColumn HeaderText="Location" UniqueName="Location">
                                               <ItemTemplate>
                                                   <asp:Label ID="lblLocation" Text='<%# Eval("Location") %>' runat="server" />
                                               </ItemTemplate>
                                               <EditItemTemplate>
                                                   <telerik:RadAutoCompleteBox ID="acLocationEdit" runat="server" AllowCustomEntry="false" TextSettings-SelectionMode="Single" InputType="Text" Width="100%">
                                                       <WebServiceSettings Path="Create.aspx" Method="GetLocationForAutoComplete" />
                                                   </telerik:RadAutoCompleteBox>
                                               </EditItemTemplate>
                                           </telerik:GridTemplateColumn>
                                           <telerik:GridTemplateColumn HeaderText="Service" UniqueName="Service">
                                               <ItemTemplate>
                                                   <asp:Label ID="lblAffectedServices" Text='<%# Eval("Service") %>' runat="server" />
                                               </ItemTemplate>                                                   
                                               <EditItemTemplate>
                                                   <div style="width:100%;">
                                                    <telerik:RadDropDownTree ID="ddlAffectedServicesEdit" Width="100%" CheckBoxes="SingleCheck" CheckNodeOnClick="true" runat="server" OnClientEntryAdding="DropDown_EntryAdding" DropDownSettings-Width="53%"></telerik:RadDropDownTree>
                                               </div>
                                               </EditItemTemplate>
                                           </telerik:GridTemplateColumn>
                                       </Columns>
                                   </MasterTableView>
                               </telerik:RadGrid>

That is my aspx page and if i try the following code in the code behind inside the onItemCommand:

if (e.CommandName == RadGrid.UpdateCommandName)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
            }

Very simple code just to try and get some data in debug, if i breakpoint on the code above, my editedItem has count of 2 old values but if i try and get for example editedItem["ID"].Text then the value returned is ""

Any ideas?

Thanks,

Scott

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 12 May 2015, 08:13 AM
Hello Scott,

Is the grid editing working as expected when placed outside the RadListView? Can you also verify that you are not binding neither the listview nor any of the grids using the DataBind() method? If this is the case, I will prepare a sample web site resembling your scenario and send it to you along with a possible solution.

Looking forward to your reply.

Regards,
Eyup
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Scott
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or