Init Insert button ( Add new record )

4 posts, 0 answers
  1. Michael Nagy
    Michael Nagy avatar
    18 posts
    Member since:
    May 2008

    Posted 02 Mar 2009 Link to this post

    Hello ,
     i used RadGrid and using need data source for binding grid , i used commandItems ( insert , .. ) and i am using automatic  edit form template .
    i want not to allow user to click add new record when the grid in edit mode
    (i.e.) i want to disable add new record button when the grid in edit mode.

     <MasterTableView GridLines="None" CommandItemDisplay="Top"

    could you help me please to find a solution for this issue .


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 02 Mar 2009 Link to this post

    Hi Michael,

    Try the following code snippet and see if it is helpful.

    CS:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))  
        {  
            foreach (GridCommandItem cmdItm in RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem))  
            {  
                LinkButton Addbtn = (LinkButton)cmdItm.FindControl("InitInsertButton");  
                Addbtn.Enabled = false;        
            }  
        }   

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael Nagy
    Michael Nagy avatar
    18 posts
    Member since:
    May 2008

    Posted 02 Mar 2009 Link to this post

    thanks so your rabidly reply ,
      but i have anothor question .. 
       i used automatic update delete i need to disable Edit link for this item  when it is in Edit mode . how can i do this ?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Mar 2009 Link to this post

    Hi Michael,

    I guess you are trying to disable the Edit button of a Grid row when it is in edit mode. If so you can try the following code snippet in the ItemDataBound event.

    CS:
       protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode)) 
            { 
                GridEditFormItem editItem = (GridEditFormItem)e.Item; 
                GridDataItem item = (GridDataItem)editItem.ParentItem; 
                LinkButton lnkbtn = (LinkButton)item["EditCol"].Controls[0]; 
                lnkbtn.Enabled = false
            } 
        } 

    Regards
    Shinu



Back to Top