Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   custom control bindable property (http://www.velocityreviews.com/forums/t756267-custom-control-bindable-property.html)

MrB 12-29-2003 04:26 PM

custom control bindable property
 
I've made a server control that overrides the dropdownlist control. It has
one new property (ddlLocation) that needs to be databound. All is working
well if I type the databound information into the asp.net html view. see
example below.

<jb:jbddl id=jbddl_court_id runat="server" Width="152px"
DataValueField="court_id" DataTextField="court" svrReadOnly="False"
DataSource='<%# objCase.getCourts() %>' ddlLocation='<%# objCase("Location")
%>'> </jb:jbddl>



However I would like the user to be able to type the databinding information
(objCase("Location")) for the ddlLocation property into the visual studio
property window - the way the datasource property works. when i do that
though, the control does not resolve the objCase("Location") to a number, it
just receives the string 'objCase("Location")'.

Here is the relevant server control code.

<Category("Data"), Bindable(True)> Public Property ddlLocation() as String

Get
Return strddlLocation
End Get

Set(ByVal Value As String)
strddlLocation = Value
End Set

End Property

What do i need to do to make the ddlLocation property act the way the
datasource property does in the vs property window?

Thanks in advance,

Jim



Alessandro Zifiglio 12-30-2003 11:37 PM

Re: custom control bindable property
 
hi jim,
if you looking for a dropdown list with DataValue fields for the selected
dataSource when clicking on your ddlLocation property in the PropertyGrid
then you might want to read this article. The code is c# but you shouldnt
have a problem converting it to vb.net --that articles goes into all the
details.
http://www.codeproject.com/aspnet/we...atabinding.asp

Here is a short explaination you can find on
MSDN --http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgu
ide/html/cpconimplementingdataboundcontroldesingerwebforms. asp


"MrB" <nospam_jambutler@comcast.net> wrote in message
news:eJLBjkizDHA.540@tk2msftngp13.phx.gbl...
> I've made a server control that overrides the dropdownlist control. It

has
> one new property (ddlLocation) that needs to be databound. All is working
> well if I type the databound information into the asp.net html view. see
> example below.
>
> <jb:jbddl id=jbddl_court_id runat="server" Width="152px"
> DataValueField="court_id" DataTextField="court" svrReadOnly="False"
> DataSource='<%# objCase.getCourts() %>' ddlLocation='<%#

objCase("Location")
> %>'> </jb:jbddl>
>
>
>
> However I would like the user to be able to type the databinding

information
> (objCase("Location")) for the ddlLocation property into the visual studio
> property window - the way the datasource property works. when i do that
> though, the control does not resolve the objCase("Location") to a number,

it
> just receives the string 'objCase("Location")'.
>
> Here is the relevant server control code.
>
> <Category("Data"), Bindable(True)> Public Property ddlLocation() as String
>
> Get
> Return strddlLocation
> End Get
>
> Set(ByVal Value As String)
> strddlLocation = Value
> End Set
>
> End Property
>
> What do i need to do to make the ddlLocation property act the way the
> datasource property does in the vs property window?
>
> Thanks in advance,
>
> Jim
>
>




MrB 12-31-2003 05:30 PM

Re: custom control bindable property
 
Thanks, I'll take a look at that article.
Jim




All times are GMT. The time now is 12:00 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57