Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Persisting a property (e.g. TabIndex) in a control's Tag on creation

Reply
Thread Tools

Persisting a property (e.g. TabIndex) in a control's Tag on creation

 
 
Ahmet Gunes
Guest
Posts: n/a
 
      06-10-2004
Hi Friends,

I'm building a web control. I came to a point that I have to persist a property (especially TabIndex) in the control's tag when the control is dropped on a Web form.
I tried several methods but none of them worked. Here is one of the methods I tried:

<PersistenceMode(PersistenceMode.Attribute), DefaultValue(-1)> Public Overrides Property TabIndex() As Short
Get
Return MyBase.TabIndex
End Get
Set(ByVal Value As Short)
MyBase.TabIndex = Value
End Set
End Property

And either in the Constructor or Init methods I set TabIndex to "0".

What I want is to get an HTML script as follows when I drop the control on a web form:

<cc3:MyTextBoxHighlight id="MyTextBoxHighlight1" style="Z-INDEX: 102; LEFT: 336px; POSITION: absolute; TOP: 176px"
runat="server" HighlightColor="192, 0, 0" TabIndex="0"></cc3:MyTextBoxHighlight>

But unfortunately, the TabIndex="0" attribute is not shown until I manually change it in the Properties window.

Can anyone help? Is what I try to do possible?

Thanks in advance,

AG



 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      06-12-2004
Hi,

so you mean TabIndex="0" should be automatically on the control at web form when dragging the control from Toolbox?. In that case, you could mark the control with ToolBoxData attribute in which you specify the default markup. This way no property override is needed

See:
http://msdn.microsoft.com/library/de...classtopic.asp

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Ahmet Gunes" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi Friends,

I'm building a web control. I came to a point that I have to persist a property (especially TabIndex) in the control's tag when the control is dropped on a Web form.
I tried several methods but none of them worked. Here is one of the methods I tried:

<PersistenceMode(PersistenceMode.Attribute), DefaultValue(-1)> Public Overrides Property TabIndex() As Short
Get
Return MyBase.TabIndex
End Get
Set(ByVal Value As Short)
MyBase.TabIndex = Value
End Set
End Property

And either in the Constructor or Init methods I set TabIndex to "0".

What I want is to get an HTML script as follows when I drop the control on a web form:

<cc3:MyTextBoxHighlight id="MyTextBoxHighlight1" style="Z-INDEX: 102; LEFT: 336px; POSITION: absolute; TOP: 176px"
runat="server" HighlightColor="192, 0, 0" TabIndex="0"></cc3:MyTextBoxHighlight>

But unfortunately, the TabIndex="0" attribute is not shown until I manually change it in the Properties window.

Can anyone help? Is what I try to do possible?

Thanks in advance,

AG



 
Reply With Quote
 
 
 
 
Ahmet Gunes
Guest
Posts: n/a
 
      06-14-2004
Hi Teemu,

Ok. that worked. But what we exactly want to do is to set the tabIndex property to an arbitrary value (e.g. Page.Controls.Count) in the control's Init event so that the programmer will not have to set the tabIndex property of this control manually.

Although when I drop the control on to a webform, the property seems to be already set (e.g. to "2") in the "Properties" window, the html code seems not to be in synch with the properties window. The code still shows tabIndex="0". When I change the property value in the Properties window, however, the change is successfully saved into the html code.

In short:

When I drop an instance of the control the first time I want tabIndex="1" in the html code
When I drop another instance of the control, this second instance shoud have tabIndex="1" in the html code.

Is that possible?

Yours,

AG

"Teemu Keiski" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi,

so you mean TabIndex="0" should be automatically on the control at web form when dragging the control from Toolbox?. In that case, you could mark the control with ToolBoxData attribute in which you specify the default markup. This way no property override is needed

See:
http://msdn.microsoft.com/library/de...classtopic.asp

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Ahmet Gunes" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi Friends,

I'm building a web control. I came to a point that I have to persist a property (especially TabIndex) in the control's tag when the control is dropped on a Web form.
I tried several methods but none of them worked. Here is one of the methods I tried:

<PersistenceMode(PersistenceMode.Attribute), DefaultValue(-1)> Public Overrides Property TabIndex() As Short
Get
Return MyBase.TabIndex
End Get
Set(ByVal Value As Short)
MyBase.TabIndex = Value
End Set
End Property

And either in the Constructor or Init methods I set TabIndex to "0".

What I want is to get an HTML script as follows when I drop the control on a web form:

<cc3:MyTextBoxHighlight id="MyTextBoxHighlight1" style="Z-INDEX: 102; LEFT: 336px; POSITION: absolute; TOP: 176px"
runat="server" HighlightColor="192, 0, 0" TabIndex="0"></cc3:MyTextBoxHighlight>

But unfortunately, the TabIndex="0" attribute is not shown until I manually change it in the Properties window.

Can anyone help? Is what I try to do possible?

Thanks in advance,

AG



 
Reply With Quote
 
Ahmet Gunes
Guest
Posts: n/a
 
      06-14-2004
sorry,

in the second sentence starting with "When.." value of tabIndex should be "2"...

When I drop another instance of the control, this second instance shoud have tabIndex="2" in the html code.

"Ahmet Gunes" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi Teemu,

Ok. that worked. But what we exactly want to do is to set the tabIndex property to an arbitrary value (e.g. Page.Controls.Count) in the control's Init event so that the programmer will not have to set the tabIndex property of this control manually.

Although when I drop the control on to a webform, the property seems to be already set (e.g. to "2") in the "Properties" window, the html code seems not to be in synch with the properties window. The code still shows tabIndex="0". When I change the property value in the Properties window, however, the change is successfully saved into the html code.

In short:

When I drop an instance of the control the first time I want tabIndex="1" in the html code
When I drop another instance of the control, this second instance shoud have tabIndex="1" in the html code.

Is that possible?

Yours,

AG

"Teemu Keiski" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi,

so you mean TabIndex="0" should be automatically on the control at web form when dragging the control from Toolbox?. In that case, you could mark the control with ToolBoxData attribute in which you specify the default markup. This way no property override is needed

See:
http://msdn.microsoft.com/library/de...classtopic.asp

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Ahmet Gunes" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi Friends,

I'm building a web control. I came to a point that I have to persist a property (especially TabIndex) in the control's tag when the control is dropped on a Web form.
I tried several methods but none of them worked. Here is one of the methods I tried:

<PersistenceMode(PersistenceMode.Attribute), DefaultValue(-1)> Public Overrides Property TabIndex() As Short
Get
Return MyBase.TabIndex
End Get
Set(ByVal Value As Short)
MyBase.TabIndex = Value
End Set
End Property

And either in the Constructor or Init methods I set TabIndex to "0".

What I want is to get an HTML script as follows when I drop the control on a web form:

<cc3:MyTextBoxHighlight id="MyTextBoxHighlight1" style="Z-INDEX: 102; LEFT: 336px; POSITION: absolute; TOP: 176px"
runat="server" HighlightColor="192, 0, 0" TabIndex="0"></cc3:MyTextBoxHighlight>

But unfortunately, the TabIndex="0" attribute is not shown until I manually change it in the Properties window.

Can anyone help? Is what I try to do possible?

Thanks in advance,

AG



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Persisting custom dictionary property Nels P. Olsen ASP .Net Building Controls 0 08-01-2006 11:05 PM
Need help persisting arraylist property. Jeremy Chapman ASP .Net Building Controls 0 02-18-2006 01:03 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
Persisting a collection property in a custom datagrid jcteague@gmail.com ASP .Net Building Controls 0 12-05-2005 09:09 PM
Persisting Custom Control's Child tag's values xb ASP .Net Web Controls 0 05-21-2004 08:53 PM



Advertisments