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

[Solved] GridDropDownColumn in validate function

1 Answer 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
syth
Top achievements
Rank 1
syth asked on 01 Oct 2009, 02:22 PM

if i have a item like this
<
telerik:GridDropDownColumn  DataField="UserName" DataSourceID="ObjectDataSource2"

                        DropDownControlType="DropDownList" EmptyListItemText="--Select User--"

                        EmptyListItemValue="--Select User--" EnableEmptyListItem="true" HeaderText="User"

                        ListTextField="FullName" ListValueField="UserName" UniqueName="FullName">

 

How can I get

Username in    Private Sub validator3_ServerValidate()

am getting  up to

 

Dim clickedItem As Telerik.Web.UI.GridDataItem = CType(CType(source, CustomValidator).NamingContainer, Telerik.Web.UI.GridDataItem)


then what should i do to get the seleted value
?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Oct 2009, 07:58 AM
Hello Syth,

You can try out the following code to access the dropdownlist's selected value in the ServerValidate event of the CustomValidator:
c#:
Private Sub validator3_ServerValidate(source As Object, args As ServerValidateEventArgs) 
    Dim clickedItem As GridDataItem = DirectCast((DirectCast(source, CustomValidator)).NamingContainer, GridDataItem) 
    Dim value As String = (DirectCast(clickedItem("FullName").Controls(0), DropDownList)).SelectedValue 
 
End Sub 

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