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

How To Get Value From GridDropDownColumn

2 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peper
Top achievements
Rank 1
Peper asked on 06 Nov 2008, 03:51 PM
Hi,

I'm using radgrid 2008 q2 with vs2005. on the radgrid property, i bound a griddropdowncolumn. usually if the bound using GridBoundColumn, i get the value with:

Dim

task_code As String = (TryCast(editedItem("task_code").Controls(0), TextBox)).Text

 


i already try this:

Dim

id_tc_type As String = (TryCast(editedItem("id_tc_type").Controls(0), DropDownList)).SelectedValue

 


but did not work, please help me.

Thanks
Peper

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Nov 2008, 04:41 AM
Hello peper,

I tried out the following code at my end, to access the selected item of the dropdownlist and it works as expected.
cs:
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) 
     If (TypeOf e.Item Is GridEditableItem) AndAlso (e.Item.IsInEditMode) Then 
         Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem) 
         Dim strtxt As String = DirectCast(item("FirstName1").Controls(0), DropDownList).SelectedValue 
     End If 
End Sub 

Thanks
Princy.
0
Peper
Top achievements
Rank 1
answered on 07 Nov 2008, 09:02 AM
Hi princy, thanks for the response. the property that i use for update data from radgrid is UpdateCommand. with my previous try and your response, i figure out that, i just need to modify a little bit of my previous try, so the result that work for me is:

Dim

id_tc As String = (TryCast(editedItem("id_tc").Controls(0), RadComboBox)).SelectedValue

 


From my previus try, i use DropDownList Not RadComboBox.

Thanks
Peper 
Tags
Grid
Asked by
Peper
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Peper
Top achievements
Rank 1
Share this question
or