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

Radgrid model binding batch editing RadDropDownList empty

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kedjour
Top achievements
Rank 1
Kedjour asked on 08 Sep 2015, 08:56 AM

Hello,

I have two objects. Resource (Id, Quantity, AgencyId, Agency), and Agency (Id, Name)

I made a grid that represents resources, and i want the user to edit them using the batch edit mode.

For the AgencyId, i want the user to choose from a dropdownlist.

When the user hit save, i can get the value of the Quantity but the value of AgencyId is Empty.

 

Here is my html. im i missing some thing ??

<telerik:RadGrid ID="AgenciesGrid" runat="server" AutoGenerateColumns="False" Height="280px">
               <ClientSettings EnableAlternatingItems="False">
                   <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                   <Selecting AllowRowSelect="true"/>
               </ClientSettings>
               <MasterTableView CommandItemDisplay="Top" HorizontalAlign="NotSet" EditMode="Batch" DataKeyNames="Id"
                                ClientDataKeyNames="Id" SelectMethod="GetAssociatedAgencies" UpdateMethod="UpdateAssociation"
                                InsertMethod="InsertAssociation" DeleteMethod="DeleteAssociation"
                                >
                   <Columns>
                       <telerik:GridTemplateColumn HeaderText="Agency" UniqueName="AgencyId" DataField="AgencyId">
                          <ItemTemplate>
                               <%# Eval("Agency.Name") %>
                           </ItemTemplate>
 
                           <EditItemTemplate>
                                <telerik:RadDropDownList runat="server" SelectMethod="GetAgencies" DataValueField="Id"
                                    DataTextField="Name" Width="200" />
                           </EditItemTemplate>
                       </telerik:GridTemplateColumn>
 
 
                       <telerik:GridNumericColumn HeaderText="Quantity" DataField="Quantity" DecimalDigits="0"/>
 
                        
                   </Columns>
               </MasterTableView>
           </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Kedjour
Top achievements
Rank 1
answered on 10 Sep 2015, 09:09 AM

Problem solved!

It turns out that the Agency.Name had an extras spaces at the end.

Triming the name property solved the problem.

Thanks.

Tags
Grid
Asked by
Kedjour
Top achievements
Rank 1
Answers by
Kedjour
Top achievements
Rank 1
Share this question
or