Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Setting a Custom Control Property that is an enumeration (or other non primative type) from aspx page

Reply
Thread Tools

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

 
 
Earl Teigrob
Guest
Posts: n/a
 
      05-14-2004
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



 
Reply With Quote
 
 
 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      05-14-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
 
 
 
Earl Teigrob
Guest
Posts: n/a
 
      05-14-2004
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." <(E-Mail Removed)> wrote in message
news:uUBW$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >
> >

>
>



 
Reply With Quote
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      05-14-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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." <(E-Mail Removed)> wrote in message
> news:uUBW$(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Earl Teigrob
Guest
Posts: n/a
 
      05-19-2004
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." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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." <(E-Mail Removed)> wrote in message
> > news:uUBW$(E-Mail Removed)...
> > > 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" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > 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
> > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the value of a Master page's control's property using a property of the Master page Nathan Sokalski ASP .Net 25 03-04-2010 03:42 AM
Re-using a simple type definition; with enumeration constraint andwithout enumeration constraint puvit82 XML 4 02-01-2008 03:46 PM
operator overloading for primative types PengYu.UT@gmail.com C++ 16 10-01-2007 08:40 AM
Setting a constructor's prototype property to a primative, array or function. Peter Michaux Javascript 1 10-30-2006 09:46 PM
Converting a Primative byte array to a Byte array object Kirby Java 3 10-08-2004 03:01 AM



Advertisments