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

hide cancel button

2 Answers 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sanjeev
Top achievements
Rank 1
Sanjeev asked on 28 Aug 2012, 12:36 PM
i am having a Radgrid in my website application. I added a GridEditCommandColumn for allowing edit the data in grid. when i clicks on Edit link, it automatically creates update and cancel button. but I dont want to display cancel button. can u please suggest me an idea for make cancel button invisible??

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Aug 2012, 12:50 PM
Hello,

Please try with below code snippet.
protected void radgrdClass_ItemDataBound(object sender, GridItemEventArgs e)
   {  
       if (e.Item.IsInEditMode)
       {
           if (e.Item is GridDataInsertItem)
           { // Insert
               GridEditableItem editItem = (GridEditableItem)e.Item;
 
               LinkButton CancelButton = (LinkButton)editItem.FindControl("CancelButton");
               CancelButton.Visible = false;
           }
           else
           {
// Edit
               GridEditableItem editItem = (GridEditableItem)e.Item;
 
               LinkButton CancelUpdateButton = (LinkButton)editItem.FindControl("CancelButton");
               CancelUpdateButton.Visible = false;
           }
       }
 
   }


Thanks,
Jayesh Goyani
0
Sanjeev
Top achievements
Rank 1
answered on 30 Aug 2012, 06:39 AM
Thanks for reply  Jayesh Goyani. It works fine in my code. i was using image button for in edit column. so instead of link button, i used data type image buton.

 GridEditableItem editItem = (GridEditableItem)e.Item;


                ImageButton CancelUpdateButton = (ImageButton)editItem.FindControl("CancelButton");
                CancelUpdateButton.Visible = false;
Thanks,
Sanjeev 
Tags
Grid
Asked by
Sanjeev
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Sanjeev
Top achievements
Rank 1
Share this question
or