Radgrid model binding batch editing RadDropDownList empty

2 posts, 0 answers
  1. Kedjour
    Kedjour avatar
    2 posts
    Member since:
    Jul 2012

    Posted 08 Sep 2015 Link to this post

    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>

  2. Kedjour
    Kedjour avatar
    2 posts
    Member since:
    Jul 2012

    Posted 10 Sep 2015 Link to this post

    Problem solved!

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

    Triming the name property solved the problem.

    Thanks.

Back to Top