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

Setting a Custom Control Property that is an enumeration (or other non primative type) from aspx page

I have a property set in my templated custom control as follows

public System.Drawing.Color tableColor;
public System.Drawing.Color TableColor
{
set
{
tableColor = value;
}
get
{
return tableColor;
}
}

In my Page Code, I would like to set the property to the color I want, Like
this (Except using code that works)

<cc:SpacerControl id="SpacerControl1"
TableColor="System.Drawing.Color.Red" runat="server">
<ItemTemplate>
Spacer Control
</ItemTemplate>
</cc:SpacerControl>

Is this possible???

Thanks

Earl

Nov 18 '05 #1
4 2934
This will not work.

You will have two publicly defined things (I can't think of the term) that
are cardinally the same.(only differ in case)

tableColor and TableColor.

So when the .aspx parser is executing, it doesn't know what to set. The
field called tableColor or the property called TableColor.

One solution is to declare the field private, or come up with another name.

Also I belive you can get away in your aspx file from just assigning
TableColor="red"

HTH,

bill

"Earl Teigrob" <ea******@hotmail.com> wrote in message
news:uJ**************@TK2MSFTNGP10.phx.gbl...
I have a property set in my templated custom control as follows

public System.Drawing.Color tableColor;
public System.Drawing.Color TableColor
{
set
{
tableColor = value;
}
get
{
return tableColor;
}
}

In my Page Code, I would like to set the property to the color I want, Like this (Except using code that works)

<cc:SpacerControl id="SpacerControl1"
TableColor="System.Drawing.Color.Red" runat="server">
<ItemTemplate>
Spacer Control
</ItemTemplate>
</cc:SpacerControl>

Is this possible???

Thanks

Earl

Nov 18 '05 #2
Bill, you are correct, the field defintion was supposted to be private, not
public. I just created this example for demonstration purposes and missed
that...and yes, just assigning the enum name worked fine...

Earl
"William F. Robertson, Jr." <wf*********@kpmg.com> wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
This will not work.

You will have two publicly defined things (I can't think of the term) that
are cardinally the same.(only differ in case)

tableColor and TableColor.

So when the .aspx parser is executing, it doesn't know what to set. The
field called tableColor or the property called TableColor.

One solution is to declare the field private, or come up with another name.
Also I belive you can get away in your aspx file from just assigning
TableColor="red"

HTH,

bill

"Earl Teigrob" <ea******@hotmail.com> wrote in message
news:uJ**************@TK2MSFTNGP10.phx.gbl...
I have a property set in my templated custom control as follows

public System.Drawing.Color tableColor;
public System.Drawing.Color TableColor
{
set
{
tableColor = value;
}
get
{
return tableColor;
}
}

In my Page Code, I would like to set the property to the color I want,

Like
this (Except using code that works)

<cc:SpacerControl id="SpacerControl1"
TableColor="System.Drawing.Color.Red" runat="server">
<ItemTemplate>
Spacer Control
</ItemTemplate>
</cc:SpacerControl>

Is this possible???

Thanks

Earl


Nov 18 '05 #3
So then what was your question? I wasn't trying to nit pick your code, I
wasn't sure if that is what you were driving at.

bill

"Earl Teigrob" <ea******@hotmail.com> wrote in message
news:e1*************@TK2MSFTNGP12.phx.gbl...
Bill, you are correct, the field defintion was supposted to be private, not public. I just created this example for demonstration purposes and missed
that...and yes, just assigning the enum name worked fine...

Earl
"William F. Robertson, Jr." <wf*********@kpmg.com> wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
This will not work.

You will have two publicly defined things (I can't think of the term) that are cardinally the same.(only differ in case)

tableColor and TableColor.

So when the .aspx parser is executing, it doesn't know what to set. The
field called tableColor or the property called TableColor.

One solution is to declare the field private, or come up with another

name.

Also I belive you can get away in your aspx file from just assigning
TableColor="red"

HTH,

bill

"Earl Teigrob" <ea******@hotmail.com> wrote in message
news:uJ**************@TK2MSFTNGP10.phx.gbl...
I have a property set in my templated custom control as follows

public System.Drawing.Color tableColor;
public System.Drawing.Color TableColor
{
set
{
tableColor = value;
}
get
{
return tableColor;
}
}

In my Page Code, I would like to set the property to the color I want,

Like
this (Except using code that works)

<cc:SpacerControl id="SpacerControl1"
TableColor="System.Drawing.Color.Red" runat="server">
<ItemTemplate>
Spacer Control
</ItemTemplate>
</cc:SpacerControl>

Is this possible???

Thanks

Earl



Nov 18 '05 #4
Bill, You answered my question, Thank You! I was getting to complicated in
trying to assign an enum value. Just use the value itself. Thats all I
needed.

Earl

"William F. Robertson, Jr." <wf*********@kpmg.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
So then what was your question? I wasn't trying to nit pick your code, I
wasn't sure if that is what you were driving at.

bill

"Earl Teigrob" <ea******@hotmail.com> wrote in message
news:e1*************@TK2MSFTNGP12.phx.gbl...
Bill, you are correct, the field defintion was supposted to be private,

not
public. I just created this example for demonstration purposes and missed
that...and yes, just assigning the enum name worked fine...

Earl
"William F. Robertson, Jr." <wf*********@kpmg.com> wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
This will not work.

You will have two publicly defined things (I can't think of the term)

that are cardinally the same.(only differ in case)

tableColor and TableColor.

So when the .aspx parser is executing, it doesn't know what to set. The field called tableColor or the property called TableColor.

One solution is to declare the field private, or come up with another

name.

Also I belive you can get away in your aspx file from just assigning
TableColor="red"

HTH,

bill

"Earl Teigrob" <ea******@hotmail.com> wrote in message
news:uJ**************@TK2MSFTNGP10.phx.gbl...
> I have a property set in my templated custom control as follows
>
> public System.Drawing.Color tableColor;
> public System.Drawing.Color TableColor
> {
> set
> {
> tableColor = value;
> }
> get
> {
> return tableColor;
> }
> }
>
> In my Page Code, I would like to set the property to the color I want, Like
> this (Except using code that works)
>
> <cc:SpacerControl id="SpacerControl1"
> TableColor="System.Drawing.Color.Red" runat="server">
> <ItemTemplate>
> Spacer Control
> </ItemTemplate>
> </cc:SpacerControl>
>
> Is this possible???
>
> Thanks
>
> Earl
>
>
>



Nov 18 '05 #5

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

Similar topics

0
by: Amir Eshterayeh | last post by:
Dear Friends Hope things goes well to you. I have this problem. Would you please give me your solution? I want to change a property that I define on my user control in my web form that contains...
2
by: Russell | last post by:
Morning, I have been having trouble with a my embedded user control not being able to see the view state that I set in its parent page. I have done a test with the following and I still cant...
2
by: Earl Teigrob | last post by:
I have a custom control that creates a textarea child control and diplays it to the user. The control is defined as follows System.Web.UI.HtmlControls.HtmlTextArea TextArea1; I have a property...
0
by: jahyen | last post by:
I'm having trouble getting my custom control to save properties that are decorated with the PersistenceMode.InnerProperty attribute. The properties that are saved with PersistenceMode.Attribute...
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: Italian Pete | last post by:
Hi, I have a div control on an aspx page. I toggle the display property between 'block' and 'none' client side using the following javascript: function toggleDivOnOff(divID) { var x =...
1
by: rs36718 | last post by:
Hi, I have page called PageMain with an Iframe, and I will load a child page named PageChild into Iframe on click of a hyperlink. Now I want to read a control/property/method of a PageMain from...
3
by: AleXmanFree | last post by:
Hi , I have got problem with passing my inline based value to y user control (or custom control, no matter which one I use, I have tried both to make sure it doesnt matter) . So say I have...
1
by: AleXmanFree | last post by:
Hi , I have got problem with passing my inline based value to y user control (or custom control, no matter which one I use, I have tried both to make sure it doesnt matter) . So say I have...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
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,...
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.