Update Grid on EditCommandColumn

4 posts, 0 answers
  1. Abdul
    Abdul avatar
    39 posts
    Member since:
    Oct 2010

    Posted 08 Mar 2011 Link to this post

    Dear All, 

    I am using Needdatasource for binding data to Radgrid and with DataTable.
     
    I need to restrict the access to edit only one column of a row instead of all columns of that row.
    I need to know a simple way to get the updated values of selected row.
    I need to update other columns of the grid on the base of updated column on EditCommandEvent occured. 

    Please Help.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Mar 2011 Link to this post

    Hello Abdul,

    If you want to access certain columns when grid is in edit mode, you can set other columns/controls as ReadOnly. Sample code is given below.
    C#:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
           {
               GridEditFormItem item = (GridEditFormItem)e.Item;
               TextBox txt = (TextBox)item["ColumnName"].Controls[0];
               txt.ReadOnly = true;
            }
       }

    And for your second and third requirement, please go throuhg the following documentation.
    Updating values in-place and with edit forms
    Retrieving original values for edited item
    Insert/Update/Delete at database level with queries

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Abdul
    Abdul avatar
    39 posts
    Member since:
    Oct 2010

    Posted 08 Mar 2011 Link to this post

    Actually not working I want the only one column to be displayed in edit form when I click on edit button. It makes the text field read only but they are still shown.
  5. Abdul
    Abdul avatar
    39 posts
    Member since:
    Oct 2010

    Posted 08 Mar 2011 Link to this post

    However this has worked for me.... 

    protected void grd_report_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {           
        if (obj_dt.Rows.Count!=0)
        {
            grd_report.DataSource = obj_dt;
            grd_report.MasterTableView.GetColumn("Column Name").EditFormHeaderTextFormat = "";
        }
    }
     
    protected void ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem item = (GridEditFormItem)e.Item;
            item["Column Name"].Visible = false;
        }
    }

    Also Called OnDataItemBound = "DataItemBound" in aspx page
Back to Top