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

Edit only single cell in telerik rad grid

3 Answers 798 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sunny
Top achievements
Rank 1
Sunny asked on 07 May 2013, 09:34 AM
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>

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 10 May 2013, 08:19 AM
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.
0
John
Top achievements
Rank 1
answered on 13 Nov 2014, 10:44 PM
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?
 
0
Viktor Tachev
Telerik team
answered on 18 Nov 2014, 01:38 PM
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.

 
Tags
Grid
Asked by
Sunny
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
John
Top achievements
Rank 1
Share this question
or