473,394 Members | 1,749 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,394 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 827
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...

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.