473,324 Members | 2,535 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,324 software developers and data experts.

Custom Controls with non-String Attributes

I want to add attributes to my custom controls that are not of type String.
I know how to convert from a String to the different types that I want, but
when the user assigns values to the attributes using properties (assigns the
values programmatically) I want them to be able to use the type I would be
converting the attribute to. For example, here are the two basic scenarios:

Assigning the value using attributes:

<mytags:linkmaker runat="server" id="linkmaker1"
url="http://www.nathansokalski.com/"></mytags:linkmaker>

Assigning the value programmatically:

linkmaker1.url=New Uri("http://www.nathansokalski.com/")

The problem is that if I make the property of type Uri I recieve a Parser
Error, and if I make it a String the user cannot programmatically assign a
Uri to it. What do I do? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Jun 24 '06 #1
3 1121
Don't expose the url property. Instead, expose an intermediate property
that returns type URI. When the property is set, set the url property of
the linkmaker object, when it's requested, convert the value of the
linkmaker url to a URI and return it.

HTH

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:uT**************@TK2MSFTNGP03.phx.gbl...
I want to add attributes to my custom controls that are not of type String.
I know how to convert from a String to the different types that I want, but
when the user assigns values to the attributes using properties (assigns
the values programmatically) I want them to be able to use the type I would
be converting the attribute to. For example, here are the two basic
scenarios:

Assigning the value using attributes:

<mytags:linkmaker runat="server" id="linkmaker1"
url="http://www.nathansokalski.com/"></mytags:linkmaker>

Assigning the value programmatically:

linkmaker1.url=New Uri("http://www.nathansokalski.com/")

The problem is that if I make the property of type Uri I recieve a Parser
Error, and if I make it a String the user cannot programmatically assign a
Uri to it. What do I do? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Jun 26 '06 #2
I'm not sure what you mean by that. Is there a small code snippet or example
I could see? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Tim Dot NoSpam" <Ti*@MindYourSpammy.spam> wrote in message
news:uU**************@TK2MSFTNGP05.phx.gbl...
Don't expose the url property. Instead, expose an intermediate property
that returns type URI. When the property is set, set the url property of
the linkmaker object, when it's requested, convert the value of the
linkmaker url to a URI and return it.

HTH

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:uT**************@TK2MSFTNGP03.phx.gbl...
I want to add attributes to my custom controls that are not of type
String. I know how to convert from a String to the different types that I
want, but when the user assigns values to the attributes using properties
(assigns the values programmatically) I want them to be able to use the
type I would be converting the attribute to. For example, here are the two
basic scenarios:

Assigning the value using attributes:

<mytags:linkmaker runat="server" id="linkmaker1"
url="http://www.nathansokalski.com/"></mytags:linkmaker>

Assigning the value programmatically:

linkmaker1.url=New Uri("http://www.nathansokalski.com/")

The problem is that if I make the property of type Uri I recieve a Parser
Error, and if I make it a String the user cannot programmatically assign
a Uri to it. What do I do? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Jun 26 '06 #3
Hello, I'm creating a custom web control and i need to set some properties
for it.
I would like to have some properties with integer values validation, colors
palette and a drop down list with some established options.
So far i've declared some reference values like integer and its
setIntegerValue functions. Also i declared a System.Draw.Color color_var_name
variable and defined a "set color" function to receive the values in the
properties menu after clicking the web control.
The "setColor" properties displays a dropdown list with values as cyan,
black and so on. I would like to know if its possible to use a palette with
color picker instead and also to declare some validation for the entered
integer values or a predefinded range.
Another question is if there is a method to have embebbed javascript and css
files with the web control. I know there is one with the server control.
I'm quite new to .net and I would appreciate any help.
Thanks a lot in advance.
Jun 28 '06 #4

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

Similar topics

0
by: Rhy Mednick | last post by:
I have a series of simple controls that I created to make some aspects of Tablet PC programming a little easier. The "Tablet PC" aspects of the controls are irrelevant to the problem I'm having,...
4
by: BBFrost | last post by:
We have a data entry application written within Framework 1.0 that contains 20+ custom user controls. The controls overlay each other so that only one custom control is visible at a time. What...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
3
by: Charles Zhang | last post by:
I want to create a simple server control that does thing like: <Mc:CollapsibleControl TitlePanelID="panel1" BodyPanelID="Panel2"> <asp:Panel ID="panel1"> ... </asp:Panel> <asp:Panel...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
11
by: Nick Gilbert | last post by:
Hi, How can I create a custom control which will wrap its content in a header and footer? eg: Is it possible to create a .NET user control which can surround other controls? eg:...
5
by: TS | last post by:
I have a custom textbox that i need to access a label's text property. the label and textbox are 2 separate controls that will be on my page. Inside my custom control i want to have access to this...
6
by: Jonathan Wood | last post by:
Although this will be a challenge at my level of ASP.NET knowledge, I'm thinking I should implement my own membership provider class. Looking over the methods I must implement, a number of...
7
by: Linda Liu[MSFT] | last post by:
Hi George, I have downloaded your sample solution and built it on my machine. I got a compilation error indicating that the type of "CustomResources" doesn't exist in the following xaml code: ...
5
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like...
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...
0
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...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
1
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: 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.