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

Edit particular column in radgrid

1 Answer 810 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Akki
Top achievements
Rank 1
Akki asked on 13 May 2012, 04:46 AM
Any help ?
Hi ,
I have a radgrid with 4 columns, where i have to edit 2nd column highlighted below. What are things i have to achieve this ?
With below code last row 2nd column of grid is in editable mode and entire row is getting highlighted..  what are things i have to do for editing all rows and only 2 column.

Please Suggest   .

   <telerik:RadGrid ID="rdGrdMenu" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="true"
                Skin="Office2007" GridLines="Both" OnItemDataBound="rdGrdMenu_ItemDataBound" >
                <MasterTableView EditMode="InPlace">
                    <Columns>
                        <telerik:GridBoundColumn HeaderText="Group Level" UniqueName="prdlvl" DataField="prdlvl"
                            Visible="true" ReadOnly="true">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Description" UniqueName="prdlvldsc" DataField="prdlvldsc"
                            Visible="true" >
                        </telerik:GridBoundColumn>

                        <telerik:GridTemplateColumn HeaderText="Budget" UniqueName="budflg" DataField="budflg">
                            <ItemTemplate>
                                <cc1:AFSAt_CodeDropDown ID="drpDownBdgt" runat="server" AtCodeType="000006" Width="100%">
                                </cc1:AFSAt_CodeDropDown>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Status" UniqueName="Status" DataField="codsts">
                            <ItemTemplate>
                                <cc1:AFSAt_CodeDropDown ID="drpDownStatus" runat="server" AtCodeType="000001" Width="100%">
                                </cc1:AFSAt_CodeDropDown>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>

Codebehind :
     protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        //to set the Grid always in edit mode
        foreach (GridDataItem item in rdGrdMenu.MasterTableView.Items)
        {
            item.Edit = true;
        }
        rdGrdMenu.Rebind();
    }

   Regards,
Akki    

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 15 May 2012, 09:42 PM
Akki:

If you want to allow your users to be able to edit the cell value of your Description column for each row, and to lock all other cell values for each of the rows, you can set "ReadOnly="true" for all other columns.

Perhaps you should use the Excel-like editing approach that is shown in the Grid/Client Edit with Batch Server Update. This allows users to make all edits for your descriptions and then make one postback to update the server.

As you'll see in this demo, you can click on all cells in any column other than the first ("ProductID") and make an edit. The first column is locked for editing by having the "ReadOnly="true".

Hope this helps!
Tags
Grid
Asked by
Akki
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or