473,394 Members | 1,567 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.

Aspx and hidden WebControl properties

Hi!

I have the following situation

public class Class1 : WebControl
{
public Class1()
: base(HtmlTextWriterTag.Div)
{
}

public new virtual int? Width
{
get { return this.ViewState["Width"] as int?; }
set { this.ViewState["Width"] = value; }
}

public new virtual int? Height
{
get { return this.ViewState["Height"] as int?; }
set { this.ViewState["Height"] = value; }
}

protected override void RenderContents(HtmlTextWriter writer)
{
writer.Write("{0}x{1}", this.Width, this.Height);
}
}

The Width and Height properties of the WebControl are hidden and their
type is changed to a nullable int. Then I have a derived class:

public class Class2:Class1
{
public override int? Width
{
get { return base.Width; }
set { base.Width = value; }
}
}

Now, in the aspx I have
<test:Class2 Width="500" Height="100" runat="server" />

I expect to get as a result: <div>500x100</div>
But I keep getting: <div Height="100">500x<div(the Height property
is never assigned a value)

Why does aspx keep ignoring a previously hidden property if it is not
overridden?

I'm using the Visual Studio 2008 SP1 and .NET Framework 3.5 SP1. IIS 7
on a Windows Server 2008.

--
Regards
Rudy
Sep 25 '08 #1
0 853

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

Similar topics

5
by: Victor Fees | last post by:
I have an XML string in a database that I would like to display using XSLT. All of that works like a champ, but I can't figure out how to embed the XML inside an ASPX page. For example, I have...
6
by: dkode8 | last post by:
Hello, I am creating an application that uses impersonation to log a user into our domain and then show them the contents of their network share where they store their files. I have all the...
0
by: Alex Nitulescu | last post by:
Hi, I have the following in project "RaducuCustomControls": Imports System.ComponentModel Imports System.Web.UI <DefaultProperty("Text"), ToolboxData("<{0}:Rotator1...
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
0
by: Charlie | last post by:
When a property of a WebControl is changed at design-time in the property window, the Render method for that WebControls runs. When the property of one WebControl cascades to another WebControl,...
1
by: Sam | last post by:
Hi all, Why can't i create a validatorControl as a child of the control to validate? It doesn't give any errors, but it just won't work (it's not validating). The reason why i want this is...
3
by: rn5a | last post by:
The ASPX FileUpload control displays a TextBox along with a 'Browse...' Button. Setting the different properties of this control just reflects the changes in the TextBox but not the Button. For...
3
by: Aamir Ghanchi | last post by:
Hi, I am wondering why the <%= % is not working when I use it to pass the clientid to a javascrip function from the aspx declaration code. Say, I have a listbox webcontrol and from its...
3
by: sweetneel | last post by:
hI all , i have developed a webcontrol library for a custom data grid. now i want to embed a aspx page for the Searching database .in to this dll. now how should i embed a aspx page with controls in...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.