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

RadGrid InPlace Update and Insert Cells are empty

0 Answers 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Perry
Top achievements
Rank 1
Perry asked on 17 Apr 2018, 04:40 PM

I am trying to use the InPlace EditMode to on a small RadGrid.  I have the AddNewRecord in the command bar and an Edit link in each column.  When I click the Edit link the row opens in edit mode but all of the cell values are blank.  I do not want a blank record how can I keep those values to be edited? 

 

<telerik:RadGrid ID="UserGrid" runat="server" RenderMode="Auto"
                         OnInsertCommand="UserGrid_InsertCommand"
                         OnUpdateCommand="UserGrid_UpdateCommand"
                         OnItemDataBound="UserGrid_ItemDataBound"
                         AllowAutomaticDeletes="false"
                         AllowAutomaticUpdates="true"
                         AllowAutomaticInserts="false"
                         OnNeedDataSource="UserGrid_NeedDataSource"
                         AutoGenerateColumns="false"
                         AllowPaging="true">
                    <MasterTableView AutoGenerateColumns="false"
                         CommandItemDisplay="Top"
                         NoDetailRecordsText=" No Users Added"
                         DataKeyNames="UserID"
                         Font-Size="Medium"
                         EditMode="InPlace">
                      <Columns>
                          <telerik:GridEditCommandColumn />
                         <telerik:GridBoundColumn HeaderText="UserId" DataField="UserID" ReadOnly="true" Visible="false"></telerik:GridBoundColumn>
                          <telerik:GridTemplateColumn UniqueName="Active" HeaderText="Active">
                              <ItemTemplate>
                                  <asp:Label runat="server" Text ='<%# DataBinder.Eval(Container.DataItem,"Active") %>'></asp:Label>
                              </ItemTemplate>
                              <EditItemTemplate>
                                  <asp:CheckBox runat="server" ID="chkActive" />
                              </EditItemTemplate>
                          </telerik:GridTemplateColumn>
                          <telerik:GridTemplateColumn UniqueName="Role" HeaderText="Role">
                              <ItemTemplate>
                                  <asp:Label runat="server" Text ='<%# DataBinder.Eval(Container.DataItem,"Role") %>'></asp:Label>
                              </ItemTemplate>
                              <EditItemTemplate>
                                  <asp:DropDownList runat="server" ID="ddlRoles">
                                      <asp:ListItem Text ="Admin" Value ="Administrator"></asp:ListItem>
                                      <asp:ListItem Text ="User" Value ="User"></asp:ListItem>
                                  </asp:DropDownList>
                              </EditItemTemplate>
                          </telerik:GridTemplateColumn>
                          <telerik:GridTemplateColumn UniqueName="FirstName" HeaderText="First Name">
                              <ItemTemplate>
                                  <asp:Label runat="server" Text ='<%# DataBinder.Eval(Container.DataItem,"FirstName") %>'></asp:Label>
                              </ItemTemplate>
                              <EditItemTemplate>
                                  <asp:TextBox runat="server" ID="txtFirstName"></asp:TextBox>
                              </EditItemTemplate>
                          </telerik:GridTemplateColumn>
                          <telerik:GridTemplateColumn UniqueName="LastName" HeaderText="Last Name">
                              <ItemTemplate>
                                  <asp:Label runat="server" Text ='<%# DataBinder.Eval(Container.DataItem,"LastName") %>'></asp:Label>
                              </ItemTemplate>
                              <EditItemTemplate>
                                  <asp:TextBox runat="server" ID="txtLastName"></asp:TextBox>
                              </EditItemTemplate>
                          </telerik:GridTemplateColumn>
                          <telerik:GridTemplateColumn UniqueName="UserName" HeaderText="User Name">
                              <ItemTemplate>
                                  <asp:Label runat="server" Text ='<%# DataBinder.Eval(Container.DataItem,"UserName") %>'></asp:Label>
                              </ItemTemplate>
                              <EditItemTemplate>
                                  <asp:TextBox runat="server" ID="txtUserName"></asp:TextBox>
                              </EditItemTemplate>
                          </telerik:GridTemplateColumn>
                          <telerik:GridTemplateColumn UniqueName="Email" HeaderText="Email">
                              <ItemTemplate>
                                  <asp:Label runat="server" Text ='<%# DataBinder.Eval(Container.DataItem,"EmailAddress") %>'></asp:Label>
                              </ItemTemplate>
                              <EditItemTemplate>
                                  <asp:TextBox runat="server" ID="txtEmail"></asp:TextBox>
                              </EditItemTemplate>
                          </telerik:GridTemplateColumn>
                      </Columns
 
                    </MasterTableView>
                    </telerik:RadGrid>

No answers yet. Maybe you can help?

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