473,320 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.WebControls
Imports System.ComponentModel
Imports System.Text
Imports System.Drawing
Imports UniversalDropdownEditor
Namespace CustomAddressControl

<DefaultProperty("Title"), ToolboxData("<{0}:Address
runat=server></{0}:Address>")_
Public Class Address
Inherits System.Web.UI.WebControls.WebControl

Private iDataSource As String
<Description("The 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.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Drawing.Design
Imports System.Windows.Forms
Imports System.Windows.Forms.Design
<System.Security.Permissions.PermissionSetAttribut e(System.Security.Permissions.SecurityAction.Deman d, Name:="FullTrust")_
Public Class EntryModeEditor
Inherits System.Drawing.Design.UITypeEditor

Public Overloads Overrides Function EditValue(ByVal context As
System.ComponentModel.ITypeDescriptorContext, ByVal provider As
IServiceProvider, 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(ByVal context As _
System.ComponentModel.ITypeDescriptorContext) As _
System.Drawing.Design.UITypeEditorEditStyle
If context Is Nothing Then
Return MyBase.GetEditStyle(context)
Else
Return System.Drawing.Design.UITypeEditorEditStyle.DropDo wn
End If

End Function

End Class

Any help/suggestions would be gratefully appreciated.

Thanks,
Kay.

Oct 25 '06 #1
0 1330

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

Similar topics

1
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...
1
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...
2
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
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...
0
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...
5
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...
0
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...
4
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.,...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.