Build lookup control using visual studio 2005






2.29/5 (10 votes)
Oct 22, 2005
1 min read

43702

1097
Custom editors in building user controls
Introduction
In this article I tried to illustrate how it's easy to develop custom user control with different types of property editors and how to make custom data binding property in visual studio 2005 beta and visual c#
While building this control, I tried to be as close as possible to the MVC (Model / View / Controller) pattern
Model
All the selection statement are based on the INFORMATION_SCHEMA system view, so that I can gain full compliance with Sql Server 2000 and Sql Server 2005
Drop Down Editors
We only need to specify UITypeEditorEditStyle.DropDown in the edit style override
I had a problem that I needed to access another property of the user control ( The Sql Connection already defined by developer) , I found a very handy reference which is context.Instance which I got it in edit value override , that I casted to my user control class
Just specify UITypeEditorEditStyle.Modal in the edit style override , the control illustrates that you can easily embed any form as your dialog in Visual Studio Developer should specify the SqlConnection property , then the table name , optionally he/she has to specify the table schema ( used heavily in Adventure Works sample database that shipped with Sql Server 2005 Beta ) , finally he has to select the columns that appear to the users in the lookup dialog Thanks to the article "Creating Custom Controls-Providing Design Time Support 1 " By Kodanda Pani as it was a good starting point for me Modal Dialog Editor
Usage
Achnowledgment
History
Initial version on 22-10-2005