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

Custom Control: DefaultValue attribute doesn't do anything

dan
Hi NG,

i am developing an asp.net Custom control which consist of some TextBoxes,
Button, ... .
To let the user of that control set for example the width of the TextBox,
the class has a property like this:

private int widthTextBox;
[Bindable(true),
Category("Appearance"),
DefaultValue(150)] //***
public int WidthTextBox
{
get
{
EnsureChildControls();
return widthTextBox;
}

set
{
EnsureChildControls();
widthTextBox = value;
}
}
The Render(HtmlTextWriter output)assigns this value to the TexBox

protected override void Render(HtmlTextWriter output)
{
UserName.Width=Unit.Pixel(WidthTextBox);
base.Render(output);
}

But the DefaultValue(150) doesn't do anything. When the user doesn't set the
WidthTextBox Property, the TextBox has "Width:0px".
What 's wrong there?

thanks,
Dan
Nov 19 '05 #1
0 1054

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

Similar topics

5
by: Guy | last post by:
Guys Hope someone can help me! I'm having real problems getting properties I type against a control I have written at design time I have written a control by inheriting from the Button control....
0
by: Joe | last post by:
I am having a hard time with setting a property on a custom server control that i am placing in a repeater. The control inherits from DropDownList. The property is being set in the repeater using...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
1
by: Sanjay Pais | last post by:
I built a custom control for all the basic web.ui.controls like textbox, label, checkbox etc etc. I added my custom attribute called ApplySecurity to the html in the page. However, when I cycle...
14
by: Prabhudhas Peter | last post by:
Hai, I've Created a User control for example a Button and i've given the font of the text as Bold and compiled it. Now i've used this Usercontrol everywhere in my project. Now i changed the font...
6
by: Peter Hartlén | last post by:
Hi! What's the correct syntax for the default value design time attribute, using classdiagram view and Custom Attributes dialog. For a boolean: DefaultValue(true) DefaultValue("true")...
2
by: shapper | last post by:
Hello, I am creating a custom web control where one of its properties is a generic list: <Bindable(True), Category("Format"), DefaultValue(""), Localizable(True)Property Features() As...
1
by: Wimpie van Lingen | last post by:
Hi I've created a control that inherits from the button control. The control has one additional property called ButtonType which can be set to Ok, Cancel, New, Edit, etc. When the ButtonType...
0
by: awburns | last post by:
I have a custom server control I've written, which I've subclassed from the System.Web.UI.Control class. When I drag it from the toolbar to the page, the following text is put into the aspx...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.