Click here to Skip to main content
15,913,027 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionUser controls and Custom controls Pin
Tina P24-Jan-07 13:12
Tina P24-Jan-07 13:12 
AnswerRe: User controls and Custom controls Pin
minhpc_bk24-Jan-07 13:57
minhpc_bk24-Jan-07 13:57 
GeneralRe: User controls and Custom controls Pin
Tina P25-Jan-07 11:37
Tina P25-Jan-07 11:37 
GeneralRe: User controls and Custom controls Pin
minhpc_bk25-Jan-07 14:33
minhpc_bk25-Jan-07 14:33 
GeneralRe: User controls and Custom controls Pin
Tina P26-Jan-07 6:46
Tina P26-Jan-07 6:46 
GeneralRe: User controls and Custom controls Pin
minhpc_bk26-Jan-07 17:47
minhpc_bk26-Jan-07 17:47 
GeneralRe: User controls and Custom controls Pin
Tina P27-Jan-07 18:18
Tina P27-Jan-07 18:18 
GeneralRe: User controls and Custom controls Pin
minhpc_bk28-Jan-07 19:04
minhpc_bk28-Jan-07 19:04 
Basically, there are a couple of options that you can use to set the Title attribute using the AlternateText property:

+ You can simple put your code in the set part of the AlternateText property and add the Title to the Attributes collection:
public virtual string AlternateText
{
	get
	{
		...
	}
	set
	{
		this.ViewState["AlternateText"] = value;
             		                    
		this.Attributes["title"] = value.
	}
}

+ You can set the title attribute when the control is rendered. Normally, there are some overridable methods get called when the control is in the rendering phase (you should read more about control life cycle in MSDN), and your job is to choose the right one to override. For example, we can override the AddAttributesToRender method to add HTML attributes and styles that need to be rendered to the writer object, or we override the RenderXXX methods when we want to add the contents or something similar to the writer. You can check out which methods are overridable and their meaning by looking at the APIs of the base class(DropDownList for instance).

+ Once you define a public custom property, AlternateText, you can define your custom control in the web page like this:
<uc1:ExDropDownList AlternativeText="myList" id="BackColor" runat="server" ...  


When the ASP.NET parser parses the ASP.NET markup, it will generate code to set the AlternateText property of the custom dropdownlist based on the value specified in the control declaration, and then when the control is rendered, the AddAttributesToRender method gets called and the Title attribute is sent out to the writer object along with the control html markup.

For more information on developing custom control, you can see MSDN[^]



GeneralRe: User controls and Custom controls Pin
Tina P29-Jan-07 18:33
Tina P29-Jan-07 18:33 
QuestionDeployment and Session State Pin
Andrew S. Kloos24-Jan-07 11:01
Andrew S. Kloos24-Jan-07 11:01 
AnswerRe: Deployment and Session State Pin
minhpc_bk24-Jan-07 14:04
minhpc_bk24-Jan-07 14:04 
Questionget the Documents and Settings directory Pin
Mack Ait-Aoudia24-Jan-07 10:38
Mack Ait-Aoudia24-Jan-07 10:38 
AnswerRe: get the Documents and Settings directory Pin
minhpc_bk24-Jan-07 14:45
minhpc_bk24-Jan-07 14:45 
Questionstring value Pin
netJP12L24-Jan-07 9:35
netJP12L24-Jan-07 9:35 
AnswerRe: string value Pin
Mack Ait-Aoudia24-Jan-07 10:55
Mack Ait-Aoudia24-Jan-07 10:55 
AnswerRe: string value Pin
Artem Kustikov25-Jan-07 0:55
Artem Kustikov25-Jan-07 0:55 
QuestionData Grid Control Pin
Civic0624-Jan-07 9:18
Civic0624-Jan-07 9:18 
AnswerRe: Data Grid Control Pin
ednrgc24-Jan-07 9:21
ednrgc24-Jan-07 9:21 
QuestionDynamic columns in Matrix report in Reporting services. Pin
kalyan_vb24-Jan-07 7:40
kalyan_vb24-Jan-07 7:40 
QuestionUsing OptGroup in DropDownList Pin
wEb GuRu...24-Jan-07 7:13
wEb GuRu...24-Jan-07 7:13 
AnswerRe: Using OptGroup in DropDownList Pin
minhpc_bk24-Jan-07 14:46
minhpc_bk24-Jan-07 14:46 
GeneralRe: Using OptGroup in DropDownList Pin
wEb GuRu...24-Jan-07 22:02
wEb GuRu...24-Jan-07 22:02 
GeneralRe: Using OptGroup in DropDownList Pin
minhpc_bk25-Jan-07 0:28
minhpc_bk25-Jan-07 0:28 
QuestionOnline Payments in Dollar and Rupees Pin
BINOVAR24-Jan-07 6:20
BINOVAR24-Jan-07 6:20 
QuestionToolbars/Windows Moving on Debug Pin
packerfan190424-Jan-07 4:21
packerfan190424-Jan-07 4:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.