WinForm------A method that uses Searchlookupedit controls in a Gridcontrol control

Source: Internet
Author: User

1. Add two tables to the database with the primary foreign key relationship

Primary key table:

FOREIGN key table:

2. Drag the Gridcont control to the toolbar and add the corresponding column, where the "province" is modified, the value of "FileName" corresponds to the database column name, the following "(Name)" can be the same as FileName;

Filename:provinceid

(Name):P Rovinceid

3. Locate the "Columnedit" attribute and click Add "Searchlookupedit" control;

4. Click the "Repository" button on the left side of the window and click "In-place Editor Repository" to modify the properties.

Valuemenber:id (primary key table ID)

Displaymember:name (primary key table Name, used to display data in the table)

Other properties (not set):

Popupformsize: Size of the container

Nulltext: The value displayed when empty

Optionsview->newitemrowposition:button (do not know what the use, online said it is best to set up in this way, the bottom layer will be more than a blank line)

5. Click the colon to modify the columns that need to be displayed

Filename:name (in the primary key table)

Width: Wide

6. Add a data source (note: Gridcontrol also needs to load the data, otherwise repositoryitemsearchlookupedit cannot display the data)

Staffgrid.datasource == _db. Provinces.orderby (p = p.name). ToList ();

7.

WinForm------A method that uses Searchlookupedit controls in a Gridcontrol control

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.