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

Remove Blank selection from radcombobox in Edit mode

1 Answer 103 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 10 Mar 2010, 06:44 PM
I have added some custom fields and bound them to  datasources.

<AdvancedForm Modal="true" Width="400" MaximumHeight="400" /> 
 
<ResourceTypes> 
 
<telerik:ResourceType KeyField="AccountNumber" Name="AccountNumber" TextField="AccountName" ForeignKeyField="AccountNumber"   
 
DataSourceID="sdsAccounts" /> 
 
<telerik:ResourceType KeyField="ContactNumber" Name="ContactNumber" TextField="ContactName" ForeignKeyField="ContactNumber" 
 
DataSourceID="sdsContacts" /> 
 
<telerik:ResourceType KeyField="TaskType" Name="Type" TextField="TaskType" ForeignKeyField="TaskType" 
 
DataSourceID="sdsTaskTypes" /> 
 
<telerik:ResourceType KeyField="TaskAction" Name="Action" TextField="TaskAction" ForeignKeyField="TaskAction" 
 
DataSourceID="sdsTaskActions" /> 
 
<telerik:ResourceType KeyField="RepNumber" Name="For" TextField="RepName" ForeignKeyField="For" 
 
DataSourceID="sdsReps" /> 
 
<telerik:ResourceType KeyField="RepNumber" Name="By" TextField="RepName" ForeignKeyField="By" 
 
DataSourceID="sdsReps" /> 
 
<telerik:ResourceType KeyField="PriorityText" Name="Priority" TextField="PriorityText" ForeignKeyField="PriorityText" 
 
DataSourceID="sdsPriority" /> 
 
</ResourceTypes>   
 

This is working but when the form loads each datasource has a blank value by default.  This blank value will mess up my SQL.
They are integer fields ich would need a value of   zero

I just want to get rid of the blank so only items in the datasource can be selected.

So i added:

    Protected Sub RadScheduler1_FormCreated(ByVal sender As Object, ByVal e As SchedulerFormCreatedEventArgs)  
 
 
        If e.Container.Mode = SchedulerFormMode.AdvancedEdit Then  
            Dim ddlContactNumber As RadComboBox = DirectCast(e.Container.FindControl("ContactNumber"), RadComboBox)  
            ddlContactNumber.Items.Remove(0)  
 
 
            Dim ddlAccountnumber As RadComboBox = DirectCast(e.Container.FindControl("Accountnumber"), RadComboBox)  
            ddlAccountnumber.Items.Remove(0)  
 
 
        End If  
    End Sub 

This tells me that it can not find the control by those names.  Am i referencing the names wrong ?


I can cause problems on your sample page as well.
http://demos.telerik.com/aspnet-ajax/scheduler/examples/outlook2007/defaultcs.aspx
If I edit one of the items and choose "" blank for the Calendar - that item goes into oblivion.





1 Answer, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 11 Mar 2010, 04:24 PM
To access the drop-down controls, you need to prefix them with "Res", so for your first one it would be ResContactNumber.

I just want to note, from my experience, even though you remove the first item from the list it will still return a null value for the first item for some odd reason, a bug most likely where it ignores the first item in the drop-down by default.

I hope that helps.
Tags
Scheduler
Asked by
David
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
Share this question
or