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

DataSet and SelectedItem Problem

2 Answers 49 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Carles Vazquez
Top achievements
Rank 1
Carles Vazquez asked on 29 Jul 2009, 11:59 PM
I need to get the value of the selectedItem NumeroIncidencia column, I looked at the examples and following the steps that detail does not work, I can help.

Thank you.

 

A simulation code to see what I'm doing

<Grid>   
    <Button Height="36" HorizontalAlignment="Right" Margin="0,11,177,0" Name="cmdBuscar" VerticalAlignment="Top" Width="36">   
        <Image Source="iconos/buscar.gif" Name="Image5" />   
    </Button>   
    <ListBox Height="100" Margin="0,40,245,0" Name="ListBox1" DisplayMemberPath="NumeroIncidencia" VerticalAlignment="Top" />   
    <telerik:RadGridView x:Name="BuscarGrid" Margin="0,160,0,0" AutoGenerateColumns="False">   
        <telerik:RadGridView.Columns >   
            <telerik:GridViewDataColumn IsReadOnly="True" Header="Numero Incidencia" UniqueName="NumeroIncidencia" Width="150"/>   
            <telerik:GridViewDataColumn IsReadOnly="True" Header="Procedencia" UniqueName="DescripcionProcedencia" Width="120"/>   
            <telerik:GridViewDataColumn IsReadOnly="True" Header="Observaciones" UniqueName="Observaciones" Width="300"/>   
        </telerik:RadGridView.Columns>   
    </telerik:RadGridView>   
</Grid> 
 
 
Private Sub cmdBuscar_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles cmdBuscar.Click   
    Dim rd As New ReturnData.ReturnDataSoapClient   
    Dim ds As DataSet   
    ds = rd.ReturnDataset("SELECT NumeroIncidencia, DescripcionProcedencia,  Observaciones FROM Incidencias")   
    Me.BuscarGrid.ItemsSource = ds.Tables(0)   
    Me.ListBox1.ItemsSource = Me.BuscarGrid.SelectedItems   
End Sub   
 
I have no ListBox1 in the desired value

2 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 04 Aug 2009, 07:59 AM
Hello Carles Vazquez,

You have indicated that you use version 2009.1.526 of our WPF suite. In that version RadGridView API does not include SelectedItems property but you can use SelecteRecords instead:

<Grid>      
    <Button Height="36" HorizontalAlignment="Right" Margin="0,11,177,0" Name="cmdBuscar" VerticalAlignment="Top" Width="36">      
        <Image Source="iconos/buscar.gif" Name="Image5" />      
    </Button>      
    <ListBox Height="100" Margin="0,40,245,0" Name="ListBox1" DisplayMemberPath="Data.NumeroIncidencia" VerticalAlignment="Top" />      
    <telerik:RadGridView x:Name="BuscarGrid" Margin="0,160,0,0" AutoGenerateColumns="False">      
        <telerik:RadGridView.Columns >      
            <telerik:GridViewDataColumn IsReadOnly="True" Header="Numero Incidencia" UniqueName="NumeroIncidencia" Width="150"/>      
            <telerik:GridViewDataColumn IsReadOnly="True" Header="Procedencia" UniqueName="DescripcionProcedencia" Width="120"/>      
            <telerik:GridViewDataColumn IsReadOnly="True" Header="Observaciones" UniqueName="Observaciones" Width="300"/>      
        </telerik:RadGridView.Columns>      
    </telerik:RadGridView>      
</Grid>   

Notice the modified DisplayMemberPath.

Private Sub cmdBuscar_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles cmdBuscar.Click      
    Dim rd As New ReturnData.ReturnDataSoapClient      
    Dim ds As DataSet      
    ds = rd.ReturnDataset("SELECT NumeroIncidencia, DescripcionProcedencia,  Observaciones FROM Incidencias")      
    Me.BuscarGrid.ItemsSource = ds.Tables(0)      
    Me.ListBox1.ItemsSource = Me.BuscarGrid.SelectedRecords    
End Sub     

Hope this helps.

All the best,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Carles Vazquez
Top achievements
Rank 1
answered on 17 Aug 2009, 02:10 PM
Tell me what has not worked, finally I found this other way of obtaining the value of the column and work for me correctly.

msgbox (Me.BuscarGrid.SelectedItem("NumeroIncidencia"))

Thank you.
Tags
GridView
Asked by
Carles Vazquez
Top achievements
Rank 1
Answers by
Milan
Telerik team
Carles Vazquez
Top achievements
Rank 1
Share this question
or