473,765 Members | 2,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display a property of a custom control with a dropdown styl

Kay
Hello,

I have written my own custom control and I want one of its properties to
display as a dropdown list when clicked, so the user can select from the
list, it would be similar to the asp textbox control which has a ‘TextMode’
property and when clicked on, displays as a dropdown list with 3 values, I
want to have a similar type property with a dropdown style.

So far, I have a property defined which displays the dropdown arrow when
clicked but does not expand, I also do not know how to populate the dropdown.
The dropdown needs to be populated with values read from the DB, the values
can be read into a Dataset/datareader (which I can do), so I need to know how
to bind these to a dropdown and have the dropdown assigned to the property.
So far I have the following:

1. My control

Imports System
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Componen tModel
Imports System.Text
Imports System.Drawing
Imports UniversalDropdo wnEditor
Namespace CustomAddressCo ntrol

<DefaultPropert y("Title"), ToolboxData("<{ 0}:Address
runat=server></{0}:Address>")_
Public Class Address
Inherits System.Web.UI.W ebControls.WebC ontrol

Private iDataSource As String
<Description("T he source/origin of the data."), _
Editor(GetType( EntryModeEditor ), _
GetType(System. Drawing.Design. UITypeEditor))_
Public Property DataSource() As String
Get
Return iDataSource
End Get
Set(ByVal Value As String)
iDataSource = Value
End Set
End Property

…………..

2. My EntryModeEditor Class

Imports System
Imports System.Componen tModel
Imports System.Componen tModel.Design
Imports System.Drawing
Imports System.Drawing. Design
Imports System.Windows. Forms
Imports System.Windows. Forms.Design
<System.Securit y.Permissions.P ermissionSetAtt ribute(System.S ecurity.Permiss ions.SecurityAc tion.Demand, Name:="FullTrus t")_
Public Class EntryModeEditor
Inherits System.Drawing. Design.UITypeEd itor

Public Overloads Overrides Function EditValue(ByVal context As
System.Componen tModel.ITypeDes criptorContext, ByVal provider As
IServiceProvide r, ByVal value As Object) As Object

Dim returnValue As Object = value
If Not (provider Is Nothing) Then

‘I DO NOT KNOW WHAT SHOULD GO IN HERE, TO POPULATE THE DROPDOWN AND GET OUT
THE VALUE THAT WAS SELECTED

End If
Return value
End Function
Public Overloads Overrides Function GetEditStyle(By Val context As _
System.Componen tModel.ITypeDes criptorContext) As _
System.Drawing. Design.UITypeEd itorEditStyle
If context Is Nothing Then
Return MyBase.GetEditS tyle(context)
Else
Return System.Drawing. Design.UITypeEd itorEditStyle.D ropDown
End If

End Function

End Class

Any help/suggestions would be gratefully appreciated.

Thanks,
Kay.

Oct 25 '06 #1
0 1348

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1926
by: DFB | last post by:
I have created a custom control which contains an asp:dropdown inside it and embedded my custom control in my web page. I am accessing this dropdown via javascript. The Problem: when this asp:dropdown control was embedded directly in my webpage ... my javascript call to reference this dropdown worked (javascript referenced call "document.all.idCategories"). BUT NOW ... because I have embedded this asp:dropdown id=idCategories within
1
1182
by: Ed Bick | last post by:
I built a custom control. It has one custom property that I created exposed. What I want to do though is to have the property show as a dropdown with only a limited number of choices for settings. An example would be the dropdown style of a combo box. The designer can only select one of three previously defined options and can not type anything arbitrary in. Can anyone explain how to do that?
2
19875
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
0
1266
by: Kay | last post by:
Hello, I have developed a web custom control, I want one of the properties of the control to appear as a dropdown list so the user can select from the list. My question is: how do I define an editor to fill up the dropdown list, so far I have the following code which displays the property as a dropdown but I do not know how to get values it to it, I have only 3 values. Public Class EntryModeEditor Inherits...
0
1240
by: Kay | last post by:
Hello, I have developed a web custom control, I want one of the properties of the control to appear as a dropdown list so the user can select from the list. My question is: how do I define an editor to fill up the dropdown list, so far I have the following code which displays the property as a dropdown but I do not know how to get values it to it, I have only 3 values. Public Class EntryModeEditor Inherits...
5
2347
by: Alan Silver | last post by:
Hello, I have a products page that takes a product ID in the query string. Based on the product details (from a database), the page then loads up one of a number of custom controls, calls a method in the control (that displays product info) and then loads the control into a placeholder so it will be displayed. I want to be able to restore the state of the controls in the custom control, but can't get it to work. For example, the...
0
1613
by: Kay O'Keeffe | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp textbox control which has a 'TextMode' property and when clicked on, displays as a dropdown list with 3 values, I want to have a similar type property with a dropdown style.
4
2738
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc., when you select the cust id. Found this cited as a good method: http://www.mvps.org/access/forms/frm0058.htm I have two tables (clients, assignments) and one form (assignment input) in the database. I have a control box called CUST ID in the...
2
4226
by: R.A.F. | last post by:
Hi, I have a custom control in which i have a collection property named "Columns". this collection property add/remove column objects. in my Column class i have a property named Alignment which use a custom property editor. when this property editor is not linked to this property,
0
10156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.