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

RadGrid value from row on doblue click

1 Answer 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Francisco
Top achievements
Rank 1
Francisco asked on 12 Nov 2013, 10:27 PM
Hi 
i have a radgrid  populated with data in double click i launch a rad window manager with texbox that need to fill with the data selected on the radgrid. i fail to get the value of the row. i can only get the index of the selected item.

this is my grid aspx:
<telerik:RadGrid ID="rgBuscar" runat="server" CellSpacing="0" Culture="es-ES"
    GridLines="None" Height="469px" Skin="Hay" Width="944px">
    <ClientSettings>
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
    <MasterTableView>
    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
    <HeaderStyle Width="20px"></HeaderStyle>
    </RowIndicatorColumn>
 
    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
    <HeaderStyle Width="20px"></HeaderStyle>
    </ExpandCollapseColumn>
 
    <EditFormSettings>
    <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
    </EditFormSettings>
 
    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
 
    </MasterTableView>
    <ClientSettings>
        <Selecting AllowRowSelect="True" />
        <ClientEvents OnRowDblClick="RowDblClick"/>
    </ClientSettings>
    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
    <FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>


and my JS:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
     
    <script type="text/javascript">
        function RowDblClick(sender, args) {
            var index = args.get_itemIndexHierarchical();
            sender.get_masterTableView().fireCommand("RowDblClick", index);
        }
    </script>
 
</telerik:RadCodeBlock>

and fianlly mi VB:

Protected Sub rgBuscar_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgBuscar.ItemCommand
    If e.CommandName = "RowDblClick" Then
        Dim var As String = e.CommandArgument
'here is where i need the value of the cell number 2 of the row
'but im getting the index
        idValor = e.Item.Cells(2).Text
        MostrarVentana(idValor)
    End If       
End Sub
 
Public Sub MostrarVentana(ByVal IdCampo As Integer)
    lector = objBd.obtenerConfiguraciones("Cambio Ordenes")
    While lector.Read
        rwmCambio.Windows(0).NavigateUrl = lector("OCON_Url") & "?IdCampo=" & IdCampo
        rwmCambio.Windows(0).Width = Unit.Pixel(lector("OCON_Width"))
        rwmCambio.Windows(0).Height = Unit.Pixel(lector("OCON_Height"))
    End While
    rwmCambio.Windows(0).VisibleOnPageLoad = True
End Sub


Thank you 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 13 Nov 2013, 05:46 AM
Hi Francisco,

You can try the following code snippet to access the cell value in ItemCommand event.

VB:
Protected Sub rgBuscar_ItemCommand(sender As Object, e As GridCommandEventArgs)
    If e.CommandName = "RowDblClick" Then
        Dim index = Integer.Parse(e.CommandArgument.ToString())
        Dim row = rgBuscar.Items(index)
        'Get the cell value
        Dim val As String = row("DataFieldName").Text
    End If
End Sub

Thanks,
Shinu
Tags
Grid
Asked by
Francisco
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or