473,383 Members | 1,737 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,383 software developers and data experts.

Custom control, defaulting style properties

I have a custom control with a property of type
System.Web.UI.WebControls.Style. In my property I've defaulted values of
the style if nothing has been sent. This gives my control a default look
but allows the user to override. My problem is, that the default values
persist to the aspx page even when they are not overwridden. It's not a huge
issue but really the values should only persist when overridden, just to
keep the aspx code small.

Code for my property:
private DatePickerStyle pCalCurrentMonthSelectedDateStyle_m;
[PersistenceMode(PersistenceMode.InnerProperty),
Category(strCATEGORY_STYLES),
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content),
NotifyParentProperty(true)]
public DatePickerStyle CalendarCurrentMonthSelectedDateStyle
{
get
{
if (this.pCalCurrentMonthSelectedDateStyle_m == null)
{
this.pCalCurrentMonthSelectedDateStyle_m = new
DatePickerStyle();
this.pCalCurrentMonthSelectedDateStyle_m.ForeColor =
System.Drawing.ColorTranslator.FromHtml("#217092") ;
this.pCalCurrentMonthSelectedDateStyle_m.BackColor =
System.Drawing.ColorTranslator.FromHtml("#D5D5D5") ;
this.pCalCurrentMonthSelectedDateStyle_m.BorderCol or =
System.Drawing.ColorTranslator.FromHtml("#000000") ;
this.pCalCurrentMonthSelectedDateStyle_m.BorderWid th =
new Unit(1, UnitType.Pixel);
this.pCalCurrentMonthSelectedDateStyle_m.BorderSty le =
BorderStyle.Solid;
this.pCalCurrentMonthSelectedDateStyle_m.Font.Unde rline
= true;
if (base.IsTrackingViewState)
{
this.pCalCurrentMonthSelectedDateStyle_m.DoTrackVi ewState();
}
}
return this.pCalCurrentMonthSelectedDateStyle_m;
}
}
Mar 7 '06 #1
0 790

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

Similar topics

4
by: Jesse Wade | last post by:
I'm trying to create a custom js object to display help text when you move the mouse over controls on a form. I've got two issues that are troubling: 1) The 'color' and 'backgroundColor'...
3
by: Joe Bloggs | last post by:
Does anyone know if its possible to pass parameters or the values of Request.QueryString from a web page to a custom control class? I'm using a C# Web Application. For Example I have Web Page1...
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: Lloyd Sheen | last post by:
I have a piece of functionallity that is replicated on several pages. This would be a good candidate for a custom control right? Well I found a couple of tutorials (none really helpful) so I...
1
by: Sky Sigal | last post by:
(PS: Cross post from microsoft.pulic.dotnet.framework.aspnet.webcontrols) I've been looking lately for a way to keep the Properties panel for Controls 'clean'... My goal is to keep similar...
1
by: Alex Nitulescu | last post by:
Hi. I'm creating my first custom controls. I have this code: Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter) output.AddAttribute("color", )...
2
by: Alani | last post by:
Hello All, I'm a new ASP.NET programmer and I want to create a custom control consist of two properties (Number1) and (Number2) and both of them are integers and default value = 0, now I'm...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
4
by: Jeff | last post by:
hi asp.net 2.0 I have created a custom web control, here is it's header: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditUserBox.ascx.cs" Inherits="Controls_EditUserBox" %> ...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.