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

Obtain value of template column in EditCommand

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 2
Brian asked on 08 Jan 2014, 06:12 PM
I'm trying to filter a SQL datasource when the EditCommand is fired.  I know I can't find the grid controls when the event fires but I'm also unable to obtain the column value for some reason.  Column A and B are not templated columns and so I access their values with row("A").text and row("B").text.  Column C is a hyperlink control and when I try and access its value with row("C").text, it always returns "".  How can I access the value?

Note that I use Dim row as GridDataItem = e.item.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Jan 2014, 04:36 AM
Hi Brian,

I guess you have a GridTemplateColumn and in its EditItemTemplate you have a HyperLink whose Text you are trying to access. Please try the following code snippet. If this doesn't help, please provide your code snippet.

VB:
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
    If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
        Dim edit As GridEditableItem = DirectCast(e.Item, GridEditableItem)    
      'Access the HyperLink in editmode
        Dim link As HyperLink = DirectCast(edit.FindControl("HyperLinkID"), HyperLink)      
        ' Gets its text
        Dim hyperlink As String = link.Text
    End If
End Sub

Thanks,
Princy
Tags
Grid
Asked by
Brian
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or