Skip Navigation LinksHome / Community & Support / Code Library / ASP.NET and ASP.NET AJAX > ComboBox > Selection out of range exception

Selection out of range exception

Feed from this thread
  • Barry avatar

    Posted on Oct 16, 2007 (permalink)

    I have just downloaded the trial and I am new to ASP .NET.  What is the best way to handle the instance of the data not matching any of the pull-down values?  The database I am working with has old values that have been disabled but I need to display them without error.  Also, how do I specify a null value in the collection editor (or in the code).

    TIA

    Reply

  • Nick Nick admin's avatar

    Posted on Oct 17, 2007 (permalink)

    Hi Barry,

    I am afraid that I cannot completely understand your task.

    RadComboBox does not support two-way binding. In other words, if you type some text that does not match any of the items, this text will not be added to the datasource. You will have to handle this case yourself. You can get the text of the input field using the Text property of the RadComboBox object and save it in your database.

    As for the null values - you could specify empty values that have neither text nor value assigned.

    Hope this helps.

    Regards,
    Nick
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Barry avatar

    Posted on Oct 17, 2007 (permalink)

    I am sorry if I was not clear describing my problem.  I pull-down list is conencted to an SQL table.  The control is bound to a field in another table.  When I select the page with the combox control and it tries to paint the control I get a selection out of range error because the data in fthe field does not exist in the pull-down table.  There are valid reasons for this to occur.  If it cannot be handled by the control is there a section sample available to handle this exception?

    Thanks

    Reply

  • Nick Nick admin's avatar

    Posted on Oct 18, 2007 (permalink)

    Hello Barry,

    I am afraid that we have not prepared such an example, yet. This exception cannot be handled by the combobox itself. You should always bind the combobox to a valid/existing data.

    Regards,
    Nick
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

    Reply

  • Marc avatar

    Posted on Nov 6, 2007 (permalink)

    Hi Barry,

    Did you read this post : http://www.telerik.com/community/forums/thread/b311D-gtthd.aspx

    I think you must add AppendDataBoundItems="true" in your combo
    exampe
    <radcb:RadComboBox ID="DriverCombo" runat="server" .... AppendDataBoundItems="true">
    <Items>
        <radcb:RadComboBoxItem Selected="true" Value="" Text="(Aucune valeur)"  />
    </Items>
    </radcb:RadComboBox>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Code Library / ASP.NET and ASP.NET AJAX > ComboBox > Selection out of range exception