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

Grid with editable column

5 Answers 110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vijayaraj
Top achievements
Rank 1
Vijayaraj asked on 08 Mar 2011, 10:58 PM
Hi,

I want to have a grid with five columns, where I need only one of the column data to be editable. Any directions would be very much appreciated.

Regards,
Vijay

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Mar 2011, 06:26 AM
Hello Vijay,

You can achieve this by setting the ReadOnly property to true.

<Telerik:GridBoundColumn DataField="EmployeeID"  ReadOnly="true" HeaderText="EmployeeID" UniqueName="EmployeeID">
</Telerik:GridBoundColumn>

Thanks,
Shinu.
0
Vijayaraj
Top achievements
Rank 1
answered on 14 Mar 2011, 01:58 PM
Thank you shinu,

I know that we can make them read only.

My problem here is to display the particular field as editable when the grid is displayed and it should have a save button to perform the save operation on the updation on that column.

I have attached a sample image.


Regards,
Vijay
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Mar 2011, 10:18 AM
Hello Vijayraj,

One option is you can use GridTemplateColumn with TextBox(for entering data) and Button(for updating)in ItemTemplate.

ASPX:
<Columns>
   <telerik:GridBoundColumn DataField="EmployeeID"  UniqueName="EmployeeID">
   </telerik:GridBoundColumn>
   <telerik:GridTemplateColumn>
       <ItemTemplate>
           <asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
           <asp:Button ID="Button2" runat="server" Text="Save" />
       </ItemTemplate>
   </telerik:GridTemplateColumn>
</Columns>

Thanks,
Princy.
0
Vasil
Telerik team
answered on 16 Mar 2011, 10:49 AM
Hi Vijayaraj,

You can set all rows in edit mode. Attach this handler to grid's PreRender event:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    foreach (GridEditableItem row in RadGrid1.Items)
    {
        row.Edit = true;
    }
    RadGrid1.Rebind();
}
Then set all columns except the last one to ReadOnly.

Kind regards,
Vasil
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Vijayaraj
Top achievements
Rank 1
answered on 16 Mar 2011, 05:00 PM
Thank you so much. I hope this would solve my problem.

Regards,
Vijayaraj
Tags
Grid
Asked by
Vijayaraj
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Vijayaraj
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Vasil
Telerik team
Share this question
or