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

[Solved] GridDropDownColumn geting seleted value in validator3_ServerValidate()

3 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PureRamu
Top achievements
Rank 1
PureRamu asked on 03 Oct 2009, 03:01 PM

<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()

Using

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

from here what to do ? to get the seleted value

3 Answers, 1 is accepted

Sort by
0
PureRamu
Top achievements
Rank 1
answered on 03 Oct 2009, 03:04 PM
in server validate i have to get 2 values

args.Value.
but i have to  get this too
0
PureRamu
Top achievements
Rank 1
answered on 03 Oct 2009, 03:07 PM
in server validate i have to get 2 values

args.Value.
but i have to  get  one more feild's value ,
 userName here.
0
Princy
Top achievements
Rank 2
answered on 05 Oct 2009, 08:28 AM
Hi PureRamu,

You can use the DropDownColumn's UniqueName property to access the corresponding cell and thereby access the dropdownlist's selected value in the ServerValidate event of the CustomValidator as shown below:
c#:
Protected Sub Validator3_ServerValidate(source As Object, args As ServerValidateEventArgs) 
 
    Dim clickedItem As GridDataItem = DirectCast((DirectCast(source, CustomValidator)).NamingContainer, GridDataItem) 
 
    Dim ddl As DropDownList = DirectCast(clickedItem("FullName").Controls(0), DropDownList) 
    Dim value As String = args.Value 
    Dim username As String = ddl.SelectedValue 
 
End Sub 

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