473,657 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent: Custom Control

Hello!

I am developing a custom server control that inherits from Hyperlink web
control.

I defined 2 new properties - ImageWidth and ImageHeight. My qustion is, how
I can override Render method so if Hyperling ImageUrl is set then add
ImageWitdh and ImageHeight attributes to image.

Thank you!
James
Nov 19 '05 #1
3 1081
Hi James:

My suggestion would be to add the attributes to the Attributes
collection of the control - the inherited functionality will take care
of rendering the attributes you specify in this collection.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 3 May 2005 16:00:13 +0300, "James T." <gi*****@hotmai l.com>
wrote:
Hello!

I am developing a custom server control that inherits from Hyperlink web
control.

I defined 2 new properties - ImageWidth and ImageHeight. My qustion is, how
I can override Render method so if Hyperling ImageUrl is set then add
ImageWitdh and ImageHeight attributes to image.

Thank you!
James


Nov 19 '05 #2
Could you please provide me an example?

James
Hi James:

My suggestion would be to add the attributes to the Attributes
collection of the control - the inherited functionality will take care
of rendering the attributes you specify in this collection.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 3 May 2005 16:00:13 +0300, "James T." <gi*****@hotmai l.com>
wrote:
Hello!

I am developing a custom server control that inherits from Hyperlink web
control.

I defined 2 new properties - ImageWidth and ImageHeight. My qustion is,
how
I can override Render method so if Hyperling ImageUrl is set then add
ImageWitdh and ImageHeight attributes to image.

Thank you!
James

Nov 19 '05 #3
Hi James:

You might want to take a look at Reflector [1] and see the source code
to for rendering the HyperLink (it's in RenderContents) . The code is
pretty straightforward , and you could actually override the method and
duplicate the code to add a couple lines and set the Image control
properties.

Do you know how to override a method? What language are you using?

[1] http://www.aisto.com/roeder/dotnet/

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 3 May 2005 16:12:25 +0300, "James T." <gi*****@hotmai l.com>
wrote:
Could you please provide me an example?

James
Hi James:

My suggestion would be to add the attributes to the Attributes
collection of the control - the inherited functionality will take care
of rendering the attributes you specify in this collection.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 3 May 2005 16:00:13 +0300, "James T." <gi*****@hotmai l.com>
wrote:
Hello!

I am developing a custom server control that inherits from Hyperlink web
control.

I defined 2 new properties - ImageWidth and ImageHeight. My qustion is,
how
I can override Render method so if Hyperling ImageUrl is set then add
ImageWitdh and ImageHeight attributes to image.

Thank you!
James


Nov 19 '05 #4

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

Similar topics

0
1028
by: Emrah Gozcu | last post by:
I have a custom control tabstrib and it loads another custom control when clicked a tab. Tabstrib event fires well but the other custom control which is dynamicly loaded after clicking a tab, does not fire its event! This is a common issue i beleive. I use the code in OnPreRender to find get the event but it is ugly! if(Page.IsPostBack && Page.Request.Form != null)
14
14635
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control so I get the ObjectDataSource. No problem ..... ObjectDataSource src = .... //is ok i have it
3
1652
by: Rolf Welskes | last post by:
Hello, this is a hint only. If you make a custom control for example witch generates code <div......</div> and I put such a control in a page then in html-view of the aspx-file I could write
11
3267
by: Nick Gilbert | last post by:
Hi, How can I create a custom control which will wrap its content in a header and footer? eg: Is it possible to create a .NET user control which can surround other controls? eg: <my:RoundedCornerBox id=foo runat=server>
5
1518
by: TS | last post by:
I have a custom textbox that i need to access a label's text property. the label and textbox are 2 separate controls that will be on my page. Inside my custom control i want to have access to this label's text. I was thinking of having a property on my textbox that was something like LabelControlID. the textbox could then do a .Findcontrol on its parent control to find this label and access its text. i thought that this might be an...
3
1421
by: Tomasz J | last post by:
Hello Developers, I have a control derived from System.Web.UI.WebControls.WebControl. Control has this property: public string Value { set { _value = value; } get { return _value; }
1
1573
by: =?Utf-8?B?V29ua28gdGhlIFNhbmU=?= | last post by:
Hello All-- Just a general (or perhaps loaded) question - is it considered good or bad practice to use code-behind with a CustomControl.generic.xaml file? For instance, with a control I'm creating, it would be nice to use a DispatchTimer to "ramp up" a value, depending on how long the mouse is held down. Thanks,
7
10909
by: Linda Liu[MSFT] | last post by:
Hi George, I have downloaded your sample solution and built it on my machine. I got a compilation error indicating that the type of "CustomResources" doesn't exist in the following xaml code: <Expander Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type res:CustomResources}, ResourceId=CustomExpanderStyle1}}" >
4
2476
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
0
8395
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7330
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.