Grid with editable column

6 posts, 1 answers
  1. Vijayaraj
    Vijayaraj avatar
    25 posts
    Member since:
    Mar 2011

    Posted 08 Mar 2011 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Mar 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vijayaraj
    Vijayaraj avatar
    25 posts
    Member since:
    Mar 2011

    Posted 14 Mar 2011 Link to this post

    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
  5. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Mar 2011 Link to this post

    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.
  6. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 16 Mar 2011 Link to this post

    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!
  7. Vijayaraj
    Vijayaraj avatar
    25 posts
    Member since:
    Mar 2011

    Posted 16 Mar 2011 Link to this post

    Thank you so much. I hope this would solve my problem.

    Regards,
    Vijayaraj
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017