Hi sir,
I have used a rad combobox for listing states, I have set data source and AllowCustomText="true". When focus on the combobox then listed all items, I wants the items are listed only after enter a text in the rad combobox (drop down disabled on focus) . eg:- if user enter ‘a’ then first letter of the sate will appear in the list.
I am having issues when using an edit template to create a new record. On insert, the same binding is assumed and does not work as there is nothng to bind to. For example, I have a date picker for which I have resricted the range from 2011 to 2050. On insert, there is no value being passed in and so an exception raised (Object cannot be cast from DBNull to other types.)
e.g.
<td>
<asp:CheckBox ID="Critical_E" runat="server" Text="Critical" Checked='<%# DataBinder.Eval( Container, "DataItem.Critical" ) %>' />
</td>
How do I either 1) disable the binding on insert, 2) create a separate insert template without having to create user controls?
Thanks,
Neil.
Protected
Sub
CustomerName_SelectedIndexChanged(
ByVal
o
As
Object
,
ByVal
e
As
RadComboBoxSelectedIndexChangedEventArgs)
Dim
editedItem
As
GridEditFormItem =
DirectCast
(rgOpportunities.MasterTableView.GetItems(GridItemType.EditFormItem)(0), GridEditFormItem)
Dim
CustomerCombo
As
RadComboBox =
DirectCast
(editedItem.FindControl(
"rcbCustomerName"
), RadComboBox)
Dim
ContactsCombo
As
RadComboBox =
DirectCast
(editedItem.FindControl(
"rcbContactName"
), RadComboBox)
If
(CustomerCombo.DataSourceID IsNot
Nothing
)
Then
CustomerCombo.DataSourceID =
String
.Empty
End
If
ContactsCombo.DataSource = LoadContacts(e.Value)
'ContactsCombo.Items.Clear()
ContactsCombo.OpenDropDownOnLoad() =
True
ContactsCombo.DataBind()
If
ContactsCombo.Items.Count > 0
Then
Session(
"ContactID"
) = ContactsCombo.Items(0).Value
Else
Session(
"ContactID"
) =
""
End
If
End
Sub
<
telerik:RadGrid
runat
=
"server"
ID
=
"RadGrid1"
AllowMultiRowSelection
=
"true"
AllowMultiRowEdit
=
"true"
EnableViewState
=
"true"
ViewStateMode
=
"Enabled"
>
<
MasterTableView
DataKeyNames
=
"ProgramPhoneListId, ProgramId, IsPrimary, AliasName, PhoneNumber, Extension, PhoneTypeValuesId"
ClientDataKeyNames
=
"ProgramPhoneListId, ProgramId, IsPrimary, AliasName, PhoneNumber, Extension, PhoneTypeValuesId"
NoMasterRecordsText
=
"Please click the 'Add' button to add a phone number..."
EditMode
=
"InPlace"
AutoGenerateColumns
=
"true"
TableLayout
=
"Fixed"
>
<
Columns
>
<
telerik:GridClientSelectColumn
UniqueName
=
"ClientSelectColumn"
CommandName
=
"Select"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
EnableRowHoverStyle
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
/>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
![]() |
|
![]() |
|
|