in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

How to load a multicolumn Dropdown control

Last post 02-28-2008 3:55 AM by C1_JohnAd. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-27-2008 2:50 PM

    How to load a multicolumn Dropdown control

    I am trying to load a multicolumn C1DropdownControl on my Windows Form.  All controls on the form are unbound, so data binding is not an issue.  However, I have the following (SQL Server 2000) table from which I need to lookup the values in order to load into the dropdown list:

    tblPerson table, related fields:

    PersonNumber
    PersonName

    I need both columns to show in the dropdown, but PersonNumber is the value to be used for the control when SelectedItem.value is inspected.

    I have set up a DataReader and related stored procedure to return these values so that I can traverse the reader & load the values into the C1DropdownControl, but the "loading the control" part is what I cannot find a reference or examples of how to do.

    Also, is this the best way for me to be going about what I want to do?  There are a number of dropdowns on the form so I figured that I should not be keeping connections and/or datasets open for the life of the form, & so this is another reason I wanted to manually load the dropdown.

    Thanks in advance for help on this.


     

    Filed under:
  • 02-28-2008 3:55 AM In reply to

    Re: How to load a multicolumn Dropdown control

    Hello,
     
    To show multiple columns in a DropDown, you have the option to use DropDownForm.
    You can find step by step implementation of the Custom DropDownform under the
    tutorials in the Help file.
     
    As far as the use of the DataReader is concerned, you can use it as far as you do not
    have the requirement to update the database again. I would also like to mention that
    the concept of DataSet is based on closed connection and DataReader requires to have
    the connection open till the time data is being accessed.
     
    However, since in your case, you only require the data to be filled in to the columns,
    then you can use either of the objects.
     
    I hope this helps.

    Regards,
     
    Allen Smith
    <tonygrigonis> wrote in message news:202339@10.0.1.98...

    I am trying to load a multicolumn C1DropdownControl on my Windows Form.  All controls on the form are unbound, so data binding is not an issue.  However, I have the following (SQL Server 2000) table from which I need to lookup the values in order to load into the dropdown list:

    tblPerson table, related fields:

    PersonNumber
    PersonName

    I need both columns to show in the dropdown, but PersonNumber is the value to be used for the control when SelectedItem.value is inspected.

    I have set up a DataReader and related stored procedure to return these values so that I can traverse the reader & load the values into the C1DropdownControl, but the "loading the control" part is what I cannot find a reference or examples of how to do.

    Also, is this the best way for me to be going about what I want to do?  There are a number of dropdowns on the form so I figured that I should not be keeping connections and/or datasets open for the life of the form, & so this is another reason I wanted to manually load the dropdown.

    Thanks in advance for help on this.


     



    http://helpcentral.componentone.com/cs/forums/p/74458/202339.aspx#202339

Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.