Hi,
I have an Issue in GridDropDownColumn .. I want to set the (DataSourceID ,, ListTextField ,, ListValueField)
in Code-behind Dynamicaly for each Row based on some Condition.
the following Code is Changing the values of each Property but It's not binding or Reflecting anything..
Designer:
Code :
Thanks..
I have an Issue in GridDropDownColumn .. I want to set the (DataSourceID ,, ListTextField ,, ListValueField)
in Code-behind Dynamicaly for each Row based on some Condition.
the following Code is Changing the values of each Property but It's not binding or Reflecting anything..
Designer:
<
telerik:GridCheckBoxColumn
DataField
=
"IsCustomer"
SortExpression
=
"IsCustomer"
UniqueName
=
"IsCustomer"
DataType
=
"System.Boolean"
ReadOnly
=
"true"
Visible
=
"false"
>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridDropDownColumn
DataField
=
"CustomerID"
UniqueName
=
"CustomerID"
EnableEmptyListItem
=
"True"
>
<
HeaderStyle
Width
=
"120px"
/>
<
ItemStyle
Width
=
"120px"
/>
</
telerik:GridDropDownColumn
>
<
telerik:GridDropDownColumn
DataField
=
"ContactID"
UniqueName
=
"ContactID"
EnableEmptyListItem
=
"True"
>
<
HeaderStyle
Width
=
"100px"
/>
<
ItemStyle
Width
=
"100px"
/>
</
telerik:GridDropDownColumn
>
Code :
Protected
Sub
rgOpportunities_ItemCreated(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
rgOpportunities.ItemDataBound
If
(
TypeOf
e.Item
Is
GridDataItem)
Then
'If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then
Dim
editFormItem
As
GridDataItem =
CType
(e.Item, GridDataItem)
Dim
Cus
As
GridDropDownColumn =
CType
(rgOpportunities.MasterTableView.Columns(8), GridDropDownColumn)
Dim
Con
As
GridDropDownColumn =
CType
(rgOpportunities.MasterTableView.Columns(9), GridDropDownColumn)
If
DirectCast
(editFormItem(
"IsCustomer"
).Controls(0), CheckBox).Checked =
True
Then
Cus.DataSourceID =
"odsCustomer"
Cus.ListTextField =
"Name"
Cus.ListValueField =
"CustomerID"
Con.DataSourceID =
"odsContact"
Con.ListTextField =
"Name"
Con.ListValueField =
"ContactID"
Else
Cus.DataSourceID =
"odsLeadHdr"
Cus.ListTextField =
"Name"
Cus.ListValueField =
"LeadHdrID"
Con.DataSourceID =
"odsLeadDtl"
Con.ListTextField =
"Name"
Con.ListValueField =
"LeadDtlID"
End
If
End
If
End
Sub
Thanks..