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

VB.NET - Selected RADGridView Item

4 Answers 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
FeRtoll
Top achievements
Rank 1
FeRtoll asked on 26 Mar 2010, 10:38 AM
First of all!!! Hello to all of you... :)

1) i have radgridview on main page and on page load i call webservice to get me data and data is returned so i put on webservice complete event myRADGrid.itemssource=e.result. That all works ok and i have something like.
"USERID" - "UserName" - "UserEmail" <-columns
1 - fertoll - fertoll@fertoll.fertoll
2 - telerik - telerik@telerik.telerik

2) i have public variables:
Public Shared Sel_ID,Sel_Name,Sel_Mail as String 

3) So when i click on item i want my variables to fill with selected data.
I added event:

Private Sub myRADGrid_SelectionChanged(ByVal sender As ObjectByVal e As Telerik.Windows.Controls.SelectionChangeEventArgs) Handles myRADGrid.SelectionChanged 
        RadRibbonButton2.IsEnabled = True 
        RadRibbonButton3.IsEnabled = True 
    End Sub 

but what to use to get data from selected item???

Sel_ID=myRADGrid.SelectedItem.what??
Sel_ID=myRADGrid.items.item(myRADGrid.selecteditem).what??

you have demo:
Telerik GridViewSelection but nothing to see there.
i searched google and found much ways to do that but all sources is missing one part of declared variables or classes so i am unable to do this!!!

can annyone help?


Sel_ID=myRADGrid.SelectedItem.what??

4 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 26 Mar 2010, 10:53 AM
Hello Marin Bartolić,

Sel_ID=myRADGrid.SelectedItem.USERID

....is the way . However you need to cast  the selected Item to the type of your business object to get access to the USER ID ...

so actually it should be something like

Sel_ID = CType(myRADGrid.SelectedItem, MyBusinessObjectType).USERID


Sincerely yours,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
FeRtoll
Top achievements
Rank 1
answered on 26 Mar 2010, 11:00 AM
ok i understand that but what is MyBusinessObjectType how to get it set it declare it is it myRADGrid.source or what that is what i dont understand and thats what is missing to me on googled sources! :) can you explain to me please i am new to telerik controls...

can u please tel me how to:

dim MyBusinessObjectType = what or where? :)

hope u understand my problem! and thanks for your quick response!

Thanks! :)
0
FeRtoll
Top achievements
Rank 1
answered on 30 Mar 2010, 06:48 AM
annyone? i know its something werry sample and it's to sample for you... but could you please explain me!

Thanks
0
FeRtoll
Top achievements
Rank 1
answered on 15 Apr 2010, 08:50 AM
For annyone else who need help like i do:

I found out how to do this! I was waiting for answer but nothing.

I made it like this:

Dim selectedUserID As Integer = CType(myRadGrid.SelectedItem, MyServiceRefference.users).ID 

myRadGrid is radgridview control
MyServiceRefference is reference to my webservice
users is table from database

Its working!

Hope i helped.
Tags
GridView
Asked by
FeRtoll
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
FeRtoll
Top achievements
Rank 1
Share this question
or