Summary of Searchlookupedit usage in devexpress

Source: Internet
Author: User



In the previous project used the devexpress, need to search a field, to pull out the corresponding information, than to go to find the Searchlookupedit user experience better, but they are a true C # and DevExpress beginners, After torturing a degree Niang, find or say lookupedit control of many, really explain searchlookupedit few, Wu Huacong blog Although mention, but said is still hold pipa half cover face. So refer to the demo, in the side of the groping side summed up some things out, now share to everyone.



1. We drag searchlookupedit into the form, now the default value for Searchlookupedit is [EditValue is null], here I rename to Searchlookupedit_code,






2. I do not use the run designer to statically bind the data source, but the dynamic use of code to bind, which is also in line with most of our style, easy to control, otherwise the change will be very troublesome, code:


 
 
1 string sqlstr = "select Dept, Code, Name, Storage, Location from Code order by Code";
2 ClassConnSQL ccs = new ClassConnSQL();
3 DataTable dt = ccs.GetTableSQL(sqlstr);
4 searchLookUpEdit_Code.Properties.ValueMember = "Code";
5 searchLookUpEdit_Code.Properties.DisplayMember = "Code";
6 searchLookUpEdit_Code.Properties.DataSource = dt;


The first three lines do not speak, this is the way to pull the data, I believe you also understand (because I am the kind of C # most dishes).



Line four, which represents the value member of the Searchlookupedit, the fifth line, represents the searchlookupedit corresponding to the display member, I represent the code here, so all use "code".



Row six, which indicates that the Searchlookupedit data source is a data table that is pulled from the database dt.



At this point, we have successfully bound the data source and can display the data, you can now type in the pop-up edit box to search for fuzzy matching, when the table matches the content will change color hint.









PS: You may notice that my default value is [edit box is empty], this is because I put devexpress official Chinese package Zh-chs file into the running directory, has been automatically Chinese.



3. Now we can fine-tune some of the details, such as:



①bestfitmode: This is the best fit mode to adjust, there are three modes to choose from.



None: The window that pops up uses the default size, and the column length defaults to the same width.



Bestfit: The width of the column is adaptive.



Bestfitresizepopup: Window self-adapting size of popup window.



②showclearbutton: Whether the Clear button is displayed



...



Some of the other details are easier to understand, and you can change the test results.



4. Special mention of the value change event editvaluechanged, which triggers this event when a change in values occurs, we can do some assignment processing and so on.






The above is my summary of searchlookupedit, because it is a beginner, there will inevitably be mistakes, welcome criticism, if there is any doubt, can also put forward, we make progress together.



Summary of Searchlookupedit usage in devexpress


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.