Edit mode in RadGrid

4 posts, 0 answers
  1. VR
    VR avatar
    6 posts
    Member since:
    Mar 2016

    Posted 05 Apr Link to this post

    Hi,

    I am new to Telerik. Not sure whether the below code is accurate since Edit link or Edit button is not appearing on the screen. The grid records gets populated but on the edit column ,the word edit is not appearing . Please find the below code

    <telerik:RadGrid RenderMode="Lightweight" ID="RadGVCurrent" runat="server"
    AllowAutomaticUpdates="True"
    OnUpdateCommand="RadGVCurrent_UpdateCommand"
    GridLines="Both" GroupPanelPosition="Top" IsExporting="False" >
    <GroupingSettings CollapseAllTooltip="Collapse all groups" />
    <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" >
    <Columns>
    <telerik:GridEditCommandColumn >
    </telerik:GridEditCommandColumn>

    <telerik:GridTemplateColumn UniqueName="Post"
    FilterControlAltText="Filter Post column">
    <ItemTemplate>
    <asp:Button ID="btnGrdPost" runat="server" CommandName="Post" Text="Post"
    OnClick="Post_Click" Font-Names="Calibri" Font-Size="X-Small"
    Height="20px" Width="50px" />
    </ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="Void" FilterControlAltText="Filter Void column" >
    <ItemTemplate>
    <asp:Button ID="btnGrdVoid" runat="server" CommandName="Void" Text="Void"
    Height="20px" Width="50px"
    OnClick="Void_Click" Font-Names="Calibri" Font-Size="X-Small" />
    </ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" UniqueName="ID"
    FilterControlAltText="Filter ID column" ></telerik:GridBoundColumn>
    <telerik:GridTemplateColumn UniqueName="EditStartDt"
    FilterControlAltText="Filter TemplateColumn2 column" >
    <EditItemTemplate>
    <table><tr><td><asp:TextBox ID="txtGrdStartDT" runat="server" Font-Names="Calibri" Font-Size="X-Small" Height="22px" ReadOnly="true" style="margin-left: 0px"
    Width="74px"></asp:TextBox>
    <asp:Calendar ID="calGrdCalendar" runat="server" BackColor="#F7F6F3"
    BorderColor="#003399" BorderWidth="1px" DayNameFormat="Shortest"
    Font-Names="Calibri" Font-Size="XX-Small" ForeColor="#284775" Height="88px"
    OnDayRender="calGrdCalendar_DayRender"
    OnSelectionChanged="calGrdCalendar_OnSelectionChanged" ShowGridLines="True"
    style="margin-right: 0px; margin-top: 1px; margin-bottom: 0px; margin-left: 0px;"
    Width="74px" SelectedDate='<%# Bind("Startdt") %>'><SelectedDayStyle BackColor="#999999" Font-Bold="True" /><SelectorStyle
    BackColor="#CC3399" /><OtherMonthDayStyle ForeColor="#284775" /><NextPrevStyle
    Font-Size="9pt" ForeColor="Silver" /><DayHeaderStyle BackColor="#CCCCCC"
    Font-Bold="True" Height="1px" /><TitleStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="9pt"
    ForeColor="White" /></asp:Calendar></td></tr></table></EditItemTemplate><ItemTemplate><table><tr><td>
    <asp:Label ID="lblStartDT" runat="server" Text='<%# Bind("StartDT") %>'
    Width="80px"></asp:Label></td></tr><tr><td><asp:Label ID="lblchk" runat="server" Text="Lv Extn"></asp:Label>
    </td><td><asp:CheckBox ID="chk1" runat="server" AutoPostBack="true"
    oncheckedchanged="chk1_CheckedChanged"
    ToolTip="Allow start leave on weekends or holidays for those extended their leave" /></td></tr></table>
    </ItemTemplate><ItemStyle HorizontalAlign="Right" Width="15%" />
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="EditEndDt"
    FilterControlAltText="Filter TemplateColumn2 column" >
    <EditItemTemplate><table><tr><td><asp:TextBox ID="txtGrdEndDT" runat="server" style="margin-left: 0px" Width="65px"
    ReadOnly="true" Height="22px" Font-Names="Calibri" Font-Size="X-Small" ></asp:TextBox>
    <asp:Calendar ID="calGrdCalendar2" OnDayRender="calGrdCalendar2_DayRender"
    runat="server" OnSelectionChanged="calGrdCalendar2_OnSelectionChanged"
    Height="88px" Width="66px"
    style="margin-right: 0px; margin-top: 1px; margin-bottom: 0px; margin-left: 0px;" BackColor="#F7F6F3"
    BorderColor="#003399" BorderWidth="1px" DayNameFormat="Shortest" Font-Names="Calibri"
    Font-Size="XX-Small" ForeColor="#284775" ShowGridLines="True" ><SelectedDayStyle BackColor="#999999" Font-Bold="True" /><SelectorStyle BackColor="#CC3399" /><OtherMonthDayStyle ForeColor="#284775" /><NextPrevStyle
    Font-Size="9pt" ForeColor="Silver" /><DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Height="1px" /><TitleStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="9pt" ForeColor="White" /></asp:Calendar></td></tr></table>
    </EditItemTemplate>
    <ItemTemplate><asp:Label ID="lblEndDT" runat="server" Width="80px" Text='<%#Eval("EndDT") %>'/></ItemTemplate><ItemStyle HorizontalAlign="Right" Width="15%" />
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="Type"
    FilterControlAltText="Filter TemplateColumn2 column" >
    <EditItemTemplate><asp:DropDownList AutoPostBack="true" ID="ddlGrdAtnType" runat="server" Width="80px"
    Font-Names="Calibri" Font-Size="X-Small"
    onselectedindexchanged="ddlGrdAtnType_SelectedIndexChanged" ></asp:DropDownList>
    </EditItemTemplate>
    <ItemTemplate><asp:Label ID="lblGrdAtendnce" runat="server" Text='<%# Bind("Type") %>' ></asp:Label></ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="Days"
    FilterControlAltText="Filter Days column" >
    <ItemTemplate><asp:Label ID="lblDays" runat="server" Font-Names="Calibri" Font-Size="X-Small"
    Text='<%# String.Format("{0:f2}",DataBinder.Eval(Container.DataItem, "Days")) %>' /></ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="Days"
    FilterControlAltText="Filter Days column" >
    <ItemTemplate><asp:Label ID="lblDays" runat="server" Font-Names="Calibri" Font-Size="X-Small"
    Text='<%# String.Format("{0:f2}",DataBinder.Eval(Container.DataItem, "Days")) %>' /></ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="Holi"
    FilterControlAltText="Filter Holi column" >
    <ItemTemplate><asp:Label ID="lblHols" runat="server"
    Text='<%# String.Format("{0:f2}",DataBinder.Eval(Container.DataItem, "Holidays")) %>'
    /></ItemTemplate> <HeaderStyle HorizontalAlign="Left" Width="20px" />
    </telerik:GridTemplateColumn>
    <telerik:GridBoundColumn DataField="Status" HeaderText="Status"
    FilterControlAltText="Filter Status column" UniqueName="Status" ></telerik:GridBoundColumn>
    <telerik:GridTemplateColumn UniqueName="Annu"
    FilterControlAltText="Filter Annu column" >
    <ItemTemplate><asp:Label ID="lblDaysAnnual" runat="server"
    Text='<%# String.Format("{0:f2}",DataBinder.Eval(Container.DataItem, "Annual")) %>'
    /></ItemTemplate><HeaderStyle HorizontalAlign="Left" Width="25px" /><ItemStyle HorizontalAlign="Right"
    Font-Names="Calibri" Font-Size="X-Small" />
    </telerik:GridTemplateColumn>
    <telerik:GridBoundColumn DataField="Notes" HeaderText="Remarks"
    FilterControlAltText="Filter Notes column" UniqueName="Notes" >
    </telerik:GridBoundColumn>


    </Columns>

    <EditFormSettings>
    <EditColumn FilterControlAltText="Filter EditCommandColumn1 column"
    UniqueName="EditCommandColumn1" >
    </EditColumn>
    </EditFormSettings>


    </MasterTableView>
    <FilterMenu RenderMode="Lightweight">
    </FilterMenu>
    <HeaderContextMenu RenderMode="Lightweight">
    </HeaderContextMenu>
    </telerik:RadGrid>

    Thanks

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Apr Link to this post

    Hello,

    The provided code looks correct and you should not encounter any problems with the edit column in the grid. The only change related to Lightweight rendering of the Grid control that was made in Q1 2016 release is described in the article below:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/mobile-support/render-modes#important-notes-about-render-mode

    Regards,
    Pavlina
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. VR
    VR avatar
    6 posts
    Member since:
    Mar 2016

    Posted 10 Apr Link to this post

    Hi Pavlina..Thanks for the response. I just removed the following code.RenderMode="Lightweight"

    Then Edit Column was appearing. If I remove the render mode will it affect any other functionality in RadGrid..

    Thanks

  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 11 Apr Link to this post

    Hi,

    I would recommend you leave Lightweight Rendering of the grid and compare your code with the one from the demo below:
    http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/automatic-crud-operations/defaultcs.aspx

    Thus you should be able to resolve the problem with the EditColumn in your case.

    Regards,
    Pavlina
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top