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

Radgrid Insert versus EditMode

2 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 15 Apr 2014, 07:29 PM
What I am trying to do is hide a textbox while my radgrid is in Edit mode, but when its in insert mode I want to show it.  I am using the radgrid_ItemDatabound event to try to mange this in isinEditMode.  but when I do this it hides it on insert or edit mode.  I want to just hide the textbox on Editmode. 

If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then
            Dim editedItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
            Dim search As TextBox = CType(editedItem.FindControl("txtSearch"), TextBox)
 
            search.Visible = False
End If




















2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Apr 2014, 04:37 AM
Hi Kevin,

Please try the following code snippet to hide a control in editmode.

VB:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
    If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode AndAlso Not e.Item.OwnerTableView.IsItemInserted Then
  Dim edit As GridEditableItem = DirectCast(e.Item, GridEditableItem)
  Dim txtSearch As TextBox = DirectCast(edit.FindControl("txtSearch"), TextBox)
    txtSearch.Parent.Parent.Visible = False
    End If
End Sub

Thanks,
Princy
0
Kevin
Top achievements
Rank 1
answered on 16 Apr 2014, 12:53 PM
Ok i got it thanks, had to take oout hte parent stuff otherwise it hide the entired edit function, but otherwise works. Thanks for help.
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kevin
Top achievements
Rank 1
Share this question
or