Edit only single cell in telerik rad grid

4 posts, 0 answers
  1. Sunny
    Sunny avatar
    26 posts
    Member since:
    Feb 2013

    Posted 07 May 2013 Link to this post

    Hello Sir/Madam,

    Currently i am using telerik rad grid in my project and my requirement is when i click on cell in telerik rad grid only that cell should be editable, no other cell should be in editable mode. here is my screen shot, in this screen shot i want to edit Vendordescription column in rad grid. so please help me asap..


    Thanx in advance...

    and here is my code:
    <telerik:RadGrid ID="Grid_PurchaseOrder_Lines" runat="server" AutoGenerateColumns="False"
                    AllowSorting="True" CellSpacing="0" GridLines="None"
                    oneditcommand="Grid_PurchaseOrder_Lines_EditCommand">
                    <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="375px" />
                    </ClientSettings>
                    <MasterTableView AutoGenerateColumns="false" DataKeyNames="CompanyId, LineDesc,ID">
                        <CommandItemSettings ExportToPdfText="Export to PDF" />
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                        </ExpandCollapseColumn>
                        <Columns>
                           
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                             UniqueName="Edit" HeaderStyle-HorizontalAlign="Center"
                                            HeaderStyle-VerticalAlign="Middle">
                                            <ItemTemplate>
                                                <asp:Button ID="edit" runat="server" CommandName="Edit" />
                                                <asp:Button ID="Cancel" runat="server" CommandName="Cancel" />
      
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Company" UniqueName="TemplateColumn1" ReadOnly="true">
                                <ItemTemplate>
                                    <%# Eval("CompanyName")%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="" HeaderText="Vendor Description"
                                UniqueName="TemplateColumn1" ReadOnly="false">
                                <HeaderStyle Width="70px" />
                                <ItemTemplate>
                                    <%#Eval("vendordescription")%>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server"
                                        Text='<%# Eval("vendordescription") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Component" UniqueName="TemplateColumn1" ReadOnly="true">
                                <HeaderStyle Width="80px" />
                                <ItemTemplate>
                                    <%# Eval("LineDesc")%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Size" UniqueName="TemplateColumn1" ReadOnly="true">
                                <ItemTemplate>
                                    <%# Eval("LineSize")%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Material/ Caliper" UniqueName="TemplateColumn1" ReadOnly="true">
                                <ItemTemplate>
                                    <%# Eval("LineMatl")%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Deco" UniqueName="TemplateColumn1" ReadOnly="true">
                                <HeaderStyle Width="70px" />
                                <ItemTemplate>
                                    <%# Eval("LineDeco")%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Coating/ Finish" UniqueName="TemplateColumn1" ReadOnly="true">
                                <ItemTemplate>
                                    <%# Eval("LineFinish")%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Quantity" UniqueName="TemplateColumn1" ReadOnly="true">
                                <ItemTemplate>
                                    <%# String.Format("{0:n0}", Eval("LineQty"))%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Unit Price" UniqueName="TemplateColumn1" ReadOnly="true">
                                <ItemTemplate>
                                    <%# String.Format("{0:C3}",Eval("UnitPrice"))%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                HeaderText="Line Total" UniqueName="TemplateColumn1" ReadOnly="true">
                                <ItemTemplate>
                                    <%# String.Format("{0:C3}",Eval("LineTotal"))%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                                UniqueName="TemplateColumn1" HeaderText="Sale Quantity" ReadOnly="true">
                                <ItemTemplate>
                                    <%# String.Format("{0:n0}", Eval("SaleQty"))%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn6 column"
                                UniqueName="TemplateColumn6" HeaderText="Sale Price" ReadOnly="true">
                                <ItemTemplate>
                                    <%# String.Format("{0:C}",Eval("SellPrice")) %>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn6 column"
                                UniqueName="TemplateColumn6" HeaderText="Sale Total" ReadOnly="true">
                                <ItemTemplate>
                                    <%# String.Format("{0:C}", Eval("SaleTotal")) %>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>
                </telerik:RadGrid>
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 10 May 2013 Link to this post

    Hello Sunny,

    As you have probably seen by default when you click on the edit button all cells in the current row are placed in edit mode. The functionality you describe is not available out of the box for RadGrid control.
    However, it could be achieved manually.

    I am sending you a sample runnable project with functionality for editing the data in a single cell.
    The cell enters in edit mode on double click. To click on the cell you would like to edit seems more natural from the user prospective.

    Additionally you could edit multiple cells and then submit the changes with a since postback.
    The editing is done on the client and after the button is clicked the changes are send to the server.

    Give this approach a try and you should succeed.

    Regards,
    Victor Tachev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John
    John avatar
    43 posts
    Member since:
    Aug 2014

    Posted 13 Nov 2014 in reply to Viktor Tachev Link to this post

    I've seen the code shown in the attachment suggested by several Telerik Admins, as the solution for editing a specific RadGrid column.  Clicking on a row and editing a column is a common every-day end-user task.   Am I the only one on the planet who thinks that is absurd amount of code for such a simple task?  Why doesn't Telerik include that as part of their base functionality for RadGrid?
     
  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 18 Nov 2014 Link to this post

    Hi John,

    RadGrid provides Batch Editing mode. This mode enables the user to make multiple changes and then submit them to the server with single request. The user can modify the values one cell at a time or an entire row.

    If you would like to see a live illustration on how Batch Editing works you would find the online demo below interesting:
    Regards,
    Viktor Tachev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top