Selection out of range exception

5 posts, 0 answers
  1. Barry
    Barry avatar
    8 posts
    Member since:
    Oct 2007

    Posted 16 Oct 2007 Link to this post

    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
  2. Nikolay
    Admin
    Nikolay avatar
    3997 posts

    Posted 17 Oct 2007 Link to this post

    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
  3. Barry
    Barry avatar
    8 posts
    Member since:
    Oct 2007

    Posted 17 Oct 2007 Link to this post

    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
  4. Nikolay
    Admin
    Nikolay avatar
    3997 posts

    Posted 18 Oct 2007 Link to this post

    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
  5. Marc
    Marc avatar
    17 posts
    Member since:
    Sep 2012

    Posted 06 Nov 2007 Link to this post

    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>
Back to Top