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

Changing properties of a custom control in code-behind


Hi,

I've written a web server custom control. If it's attributes are set at
design time in the HTML it works fine. But I want to also be able to
dynamically change some of the properties in the code behind file. Is there
any way to do this? When I write the code for the button_click event to set
the properties, the control doesn't render with the changed properties the
way it should.

Any ideas?

Philip
Nov 17 '05 #1
2 1854
Use this:
Control1.Attributes.Add("left","10");
put this in the page load. Any html attribute would follow that same format.
When the control renders clientside, these settings override the default.
regards

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits/default.htm

<sp**@merrimac.net> wrote in message
news:OI*************@tk2msftngp13.phx.gbl...

Hi,

I've written a web server custom control. If it's attributes are set at
design time in the HTML it works fine. But I want to also be able to
dynamically change some of the properties in the code behind file. Is there any way to do this? When I write the code for the button_click event to set the properties, the control doesn't render with the changed properties the
way it should.

Any ideas?

Philip

Nov 17 '05 #2
Use this:
Control1.Attributes.Add("left","10");
put this in the page load. Any html attribute would follow that same format.
When the control renders clientside, these settings override the default.
regards

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits/default.htm

<sp**@merrimac.net> wrote in message
news:OI*************@tk2msftngp13.phx.gbl...

Hi,

I've written a web server custom control. If it's attributes are set at
design time in the HTML it works fine. But I want to also be able to
dynamically change some of the properties in the code behind file. Is there any way to do this? When I write the code for the button_click event to set the properties, the control doesn't render with the changed properties the
way it should.

Any ideas?

Philip

Nov 17 '05 #3

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

Similar topics

1
by: Fred Chen | last post by:
Hi, I've created a custom component. I want one of the properties of my custom component to be the output file name which is found in project properties. I know that I can get this by writing...
4
by: Steve Amey | last post by:
Hi all I am creating a basic control to perform some tasks, and I want to declare some events to be raised so they can be handled from the form that the control is on. I can create my own Event...
5
by: Jason Butera | last post by:
I know that I can read/write custom properties of an object by using the following: Setting: document.all.customProp = "this"; Getting: document.all.customProp; Is there a way I can run...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
1
by: Jeff Smith | last post by:
Can I load custom web user controls dynamically and access the properties and methods without having to explicitly define custom control types (example 2 below). I have custom web control named...
1
by: Christophe Peillet | last post by:
I have a CompositeControl with two types of properties: 1.) Mapped Properties that map directly to a child control's properties (ex.: this.TextboxText = m_txt.Text). These properties are handled...
1
by: V | last post by:
Hello! I made custom control with tables and labels in it. In my page I have several of these controls. Each one should have different color of tables etc. I have different SkinIDs for that....
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...
3
by: Dan Soendergaard | last post by:
I have this code: for (int i = 0; i < this.Controls.Count; i++) { if (this.Controls is ValidationTextBox) { // Change the property of the control here. } }
6
by: James Hahn | last post by:
That looks like proper Property set code to me. What is the line of code that the designer is generating in the Sub InitializeComponent for a color that you select in the Properties Settings? ...
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.