Remove Blank selection from radcombobox in Edit mode

2 posts, 0 answers
  1. David
    David avatar
    77 posts
    Member since:
    Apr 2008

    Posted 10 Mar 2010 Link to this post

    I have added some custom fields and bound them to  datasources.

    <AdvancedForm Modal="true" Width="400" MaximumHeight="400" /> 
    <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" /> 

    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)  
                Dim ddlAccountnumber As RadComboBox = DirectCast(e.Container.FindControl("Accountnumber"), RadComboBox)  
            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.
    If I edit one of the items and choose "" blank for the Calendar - that item goes into oblivion.

  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 11 Mar 2010 Link to this post

    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top